Re: sequence - Mailing list pgsql-general

From Michael Schmidt
Subject Re: sequence
Date
Msg-id BAYC1-PASMTP1247DFBB86BF2D9AC2323AA36B0@CEZ.ICE
Whole thread Raw
In response to Re: sequence  ("Scott Marlowe" <scott.marlowe@gmail.com>)
List pgsql-general
Another option is to set the default value of the field to the nextval,
such as for mytable primary key field
nextval(('public.users_user_id_seq'::text)::regclass).  Then, when you
write your SQL
INSERT INTO mytable VALUES(default).  I do it this way and find it a
little cleaner.  If you want to access the users_user_id_seq value
within the same transaction, then after the insert into mytable you can
use currval.

Michael Schmidt

pgsql-general by date:

Previous
From: "x asasaxax"
Date:
Subject: Problems with acessing xml functions on other database
Next
From: Brian Herlihy
Date:
Subject: Log statement length limit