Search Postgresql Archives

Re: sequence

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux