Hi,
thanks for the feedback Graeme, but if possible, I would prefer not to use 
the SEQUENCE feature of postgreSQL, for portability issues.

I got this running thanks to the 'in-depth' postgres docs, but I am not sure 
if it is the proper way.

I have a function like this:

CREATE FUNCTION insert_update_id() RETURNS int4
AS 'UPDATE b SET id = id + 1; SELECT b.id AS RESULT'
LANGUAGE 'sql';

Whenever I do an INSERT, I pass in the function for the value.

INSERT INTO a (id,...) VALUES (insert_update_id(),..);

As the SQL query strings will be hardcoded once into a cgi, there is no 
possibility of accidently entering in another vlaue instead of the function.
Is this a kludge, or an acceptable way of doing this? Maybe it causes less 
overhead than the trigger method?
Thanks for your time,
Alex
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

--
SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
To unsubscribe send email to [EMAIL PROTECTED] with
unsubscribe in the text

Reply via email to