Search Postgresql Archives

Re: Add a serial column to a table based on a sort clause

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

 



On Wed, Sep 02, 2009 at 04:40:13PM +0400, Igor Katson wrote:
> I have a table, which has a creation_ts (timestamp) column, but does
> not have a id (serial) column. I want to add such a one, but, AFAIK,
> if I enter
> 
> ALTER TABLE table ADD COLUMN id serial
> 
> it will randomly put the sequence numbers.

"Random" is how you should think of them.  Sequences guarantee only
uniqueness.  Neither order nor gap-less numbers, nor any other
property apply to them.

Cheers,
David.
-- 
David Fetter <david@xxxxxxxxxx> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@xxxxxxxxx

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

-- 
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