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

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to