[GENERAL] Per session variables

2006-05-27 Thread Richard Smith

Hi guys,

I've googled about a bit, and found some ideas for solving this problem, 
but I thought I'd pose the question, in the hope that someone can 
suggest something.


I've got a web application that needs to do audit logging, taking some 
information provided by the webapp such as user, request path, remote IP 
etc...


Since I can't create users in postgres, and would like to be able to do 
the audit logging transparently, would anyone have any ideas as to a way 
I can do this kind of thing.


I need to avoid using external libraries if possible so if anyone has 
any tricks I'd appreciate it.


I did find a mention of some features in 8.0 that I might be able to 
exploit, however there was no details of what those features were, your 
typical useless reply to a mailing list post. There was also a myfunc 
module that would fill my needs, but I don't really want to load 
external modules into the db.


I'm running PG8.1


Ta

--
Rich

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
  choose an index scan if your joining column's datatypes do not
  match


Re: [GENERAL] ALTERING A TABLE

2000-06-01 Thread Richard Smith

--snip--

Or is that CAST it on the wasy.

Richard



Re: [GENERAL] PostgreSQL book completed though chapter 10

2000-05-19 Thread Richard Smith

Bruce Momjian wrote:
> 
> I have completed the first draft of my book through chapter 10.
> 
> New chapters include:
> 
> Chapter 7, Numbering rows:  OID's, sequences
> 
> Chapter 8, Combining Selects:  UNION, subqueries
> 
> Chapter 9, Data Types:  types, functions, operators, arrays
> 
> Chapter 10,Transactions and Locks:  transactions, locking
> 
> The books is accessible at:
> 
> http://www.postgresql.org/docs/awbook.html
> 
> Comments welcomed.
> 
> --
>   Bruce Momjian|  http://www.op.net/~candle
>   [EMAIL PROTECTED]   |  (610) 853-3000
>   +  If your life is a hard drive, |  830 Blythe Avenue
>   +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026

I just Finished reading your book, I did work along with the text up to
chapter
4. I hope to finish that up when I get the time.  It is looking great. 
I am a pgsql beginner and this book has help me out a lot.  

I know that data modeling is a huge subject, but you might want to add a
small chapter on that subject.

I look forward to reading more drafts, and thank you for the great work
so far.

Richrad



[GENERAL] beginner Table data type question

2000-05-19 Thread Richard Smith

Hi, I just start using pgsql and I am new to SQL also.  I have read lots
of
documents on this and I cant seem to find the answer, perhaps you can
help me.

Say I have a table:

pgsql=> \d test_table

test_table
--
f1| CHAR (40)
f2| CHAR (40)

Somewhere down the line I need to change the data type on f2 to CHAR
(50) and add constrains like UNIQUE.  What is the best was to change
tables in this way?
Can I just make a new table the way I want and COPY the data out of the
old table and COPY it back in?  do I use CAST ?  Is there some ALTER
TABLE tablename MODIFY command I can use?

This question has been bugging me for awhile. Because I am new to SQL I
find that I make bad design choices about data types and such all the
time. So I need to know the best way to change them.

Richard



[GENERAL] INSERT WITH SELECT help

2000-05-21 Thread Richard Smith

I am new to SQL so bare with me here.

I have set up a contact database.  The PRIMANY KEY is person.per_id 
All the other tables REFERENCE the person.per_id key.  Now I want to be
able
to INSERT INTO the address table based on person.per_id by name without
having to know the value of person.per_id.  Something like, I know this
does not work
but you will get the idea of what I need.

INSERT INTO address 
(per_id,street,city,state,zip) 
VALUES ('('SELECT per_id FROM person WHERE first ='somename')','200 some
street',
'Tampa','FL','33654');  

Can somthing like this be done ?  Any help would be great.



Re: [GENERAL] INSERT WITH SELECT help

2000-05-26 Thread Richard Smith

--snip--

Yes, I like the Idea of picking from a list if you get a return > 1.

off topic:

The main point of this whole little project was to design a SQL
database and make a Web interface to it.  One of my  main goals
was to learn the how and why's of SQL.  My Zope skill are sub par
also, so a good bushing up on dtml and form design was number two.
Of course FUN was number three.  I must say I have meet my goals,
and I now see how far I have to go as A DBA or a ZOPIST.  So much
of what I have learn has really shown me that, anything can be done
with enough work, fore thought and of course help from others.

Richard