Re: auto-increment column

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: auto-increment column
Date: 2011-10-04 12:24:51
Message-ID: 4E8AFB13.9060905@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message DUPREZ Cédric 2011-10-04 12:35:50 Re: Problem with pg_upgrade from 9.0 to 9.1 under Ubuntu x64
Previous Message Robert Buckley 2011-10-04 12:05:39 Re: auto-increment column