Re: Changing ids conflicting with serial values?

From: MaXX <bs139412(at)skynet(dot)be>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Changing ids conflicting with serial values?
Date: 2005-11-04 06:44:08
Message-ID: dkf001$1qdo$1@talisker.lacave.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2005-11-04 06:59:00 Re: Looping through arrays
Previous Message David Fetter 2005-11-04 05:18:46 Re: Looping through arrays