Re: question about auto increment like

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: question about auto increment like
Дата
Msg-id 200304031651.18884.josh@agliodbs.com
обсуждение исходный текст
Ответ на question about auto increment like  (Don Patou <pknoob@noos.fr>)
Список 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 по дате отправления:

Предыдущее
От: "pat pat"
Дата:
Сообщение: Re: question about auto increment like
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: ERROR: More than one tuple returned by a subselect used as an expression.