Re: auto-increment column - Mailing list pgsql-general

From Boszormenyi Zoltan
Subject Re: auto-increment column
Date
Msg-id 4E8AFB13.9060905@cybertec.at
Whole thread Raw
In response to Re: auto-increment column  (Robert Buckley <robertdbuckley@yahoo.com>)
List pgsql-general
Hi,

2011-10-04 14:05 keltezéssel, Robert Buckley írta:
Thanks for the replies,

I have one question regarding this comment...

"You also need to add a DEFAULT expression and optionally
make the sequence owned by the column:"

What difference does it make if a table "owns" a sequence of not?...does this contraint the use of the sequence to ONLY that one table?

The sequence will only be used to auto-increment the id column in order to have an automatic primary key. Could I then somehow use the sequence for all tables which need this?

yours,

Rob

please, don't use top-posting. It messes up the order of the messages.

The sequenced that is OWNED BY a column can of course be used
by other columns in other tables. You can specify nextval('same sequence')
for any number of columns' default value.

Best regards,
Zoltán Böszörményi

-- 
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de    http://www.postgresql.at/

pgsql-general by date:

Previous
From: Robert Buckley
Date:
Subject: Re: auto-increment column
Next
From: senthilnathan
Date:
Subject: PG Source Compilation (Optional Features / Optional Packages)