Re: serial column

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: serial column
Дата
Msg-id 1159205826.7578.91.camel@dogma.v10.wvs
обсуждение исходный текст
Ответ на Re: serial column  (Gevik Babakhani <pgdev@xs4all.nl>)
Список pgsql-general
On Mon, 2006-09-25 at 00:19 +0200, Gevik Babakhani wrote:
> On Sun, 2006-09-24 at 14:49 -0700, Bob Pawley wrote:
> > It's the behavior I expect - but the gaps aren't acceptable.
> >
> > Bob
>
> Then using the SERIAL or SEQUENCE won't do you any good.
>
> A possible solution for this would be to regenerate the entire column's
> values every time a record gets deleted starting form 1. but then again
> this would be very slow if you have a very large table
>

It doesn't have to be slow. It seems to me this is more of a
presentation issue than a data issue. He can just have a serial column,
when you select from that table order by the serial, and then assign the
numbers on the client side.

If the original poster really needs to do it in the database server I
guess he could use a procedural language and create a table function
(i.e. returns setof ...) . There's nothing relational about what he
wants to do, and PostgreSQL has procedural languages to handle
procedural tasks.

Regards,
    Jeff Davis


В списке pgsql-general по дате отправления:

Предыдущее
От: Bob Pawley
Дата:
Сообщение: Re: serial column
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: Replication and PITR