Search Postgresql Archives

Re: Primary key

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

 



On 14/03/2011 15:35, Allan Kamau wrote:

CREATE SEQUENCE hy3_pack_seq MINVALUE 1000;
CREATE TABLE hy3_pack
(
hy3_id INTEGER NOT NULL DEFAULT nextval('hy3_pack_seq') -- or hy3_id
BIGINT NOT NULL DEFAULT nextval('hy3_pack_seq')

That's what SERIAL does for you, in one go - it's just syntactic sugar for the above. Read all about it here:

http://www.postgresql.org/docs/9.0/static/datatype-numeric.html#DATATYPE-SERIAL


Ray.


--
Raymond O'Donnell :: Galway :: Ireland
rod@xxxxxx

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[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