Re: Changing ids conflicting with serial values? - Mailing list pgsql-general

From MaXX
Subject Re: Changing ids conflicting with serial values?
Date
Msg-id dkf001$1qdo$1@talisker.lacave.net
Whole thread Raw
In response to Changing ids conflicting with serial values?  (Steven Brown <swbrown@ucsd.edu>)
List pgsql-general
Steven Brown wrote:

> When I change an id (primary key serial) in a table, the next value
> returned by the sequence for the id can conflict with that id (e.g.,
> change the id to be id + 1).  [...]
If you're doing this to have a custom ordering of your data, consider adding
another int column without PK so you can change whatever you want, and keep
an unique way to access (an identify) your data even if it has been
moved...

In my case I wanted to sort my row freely, my first tough was to use the
already existing id (serial PK) column and change it. That worked fine
until I tryied to move a row without freeing the destination first... I
added a new column and changed my "order by" to match its name.

If this can help,
--
MaXX


pgsql-general by date:

Previous
From: Douglas McNaught
Date:
Subject: Re: Postgresql connection on suse 10
Next
From: Joe Conway
Date:
Subject: Re: Array Values and References