Re: question about auto increment like - Mailing list pgsql-novice

From Josh Berkus
Subject Re: question about auto increment like
Date
Msg-id 200304031651.18884.josh@agliodbs.com
Whole thread Raw
In response to question about auto increment like  (Don Patou <pknoob@noos.fr>)
List pgsql-novice
pat,

> >>What do these numbers represent?   If we're talking about
> >>a key for the table,
> >>that's such a bad idea I won't help you with it.   If
> >>we're talking about
> >>something else (like an entry sequence number) there are
> >>a few ways to do it,
> >>but an auto-increment number (e.g. SERIAL) isn't one of
> >>them.
>
> indeed it is a entry sequence number, not a key.

You will need a trigger to keep it sequential, then.   I have a set of
triggers that does this for an ordered set of entries in a table. Keep in
mind that this will make deletes from the table really slow, as all of the
entries higher than the deleted row will have to be adjusted.

Unfortunately, I'm in the middle of a large data conversion right now; please
pester me in a week and I'll get you the triggers.  Or maybe someone else
will post something.


--
-Josh Berkus
 Aglio Database Solutions
 San Francisco


pgsql-novice by date:

Previous
From: "pat pat"
Date:
Subject: Re: question about auto increment like
Next
From: Josh Berkus
Date:
Subject: Re: ERROR: More than one tuple returned by a subselect used as an expression.