Re: Better alternative for Primary Key then serial??

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Better alternative for Primary Key then serial??
Дата
Msg-id 20071212204445.GM7925@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: Better alternative for Primary Key then serial??  (pilzner <belisarius23@yahoo.com>)
Список pgsql-general
pilzner wrote:
>
>
>
> Alvaro Herrera-3 wrote:
> >
> > Just do not update the ID -- what use do you have for that
> > anyway?  If you want to prevent it, you can put a trigger to the column,
> > but IMHO it would be a waste of your time and machine resources.
> >
>
> I have absolutely no use to update the ID. I'm not sure why anyone ever
> would, and I guess I was a little shocked to find that PostGres even allows
> it.

Oh, I see.  Fact is, Postgres defines it like a plain integer column and
attaches a DEFAULT clause.  That's it.  There's no magic to prevent it
from being modified.

The SQL standard specifies a strange beast called GENERATED BY which has
all sorts of funny behaviors, one of which is what you describe.  There
have been attempts at implementing the semantics described be the spec,
but they are so contorted that so far there hasn't been definitive
success.  It is expected that in the next release (8.4) something will
get done about it.

--
Alvaro Herrera                        http://www.advogato.org/person/alvherre
"How strange it is to find the words "Perl" and "saner" in such close
proximity, with no apparent sense of irony. I doubt that Larry himself
could have managed it."         (ncm, http://lwn.net/Articles/174769/)

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

Предыдущее
От: Steve Crawford
Дата:
Сообщение: Re: Altering field passed as parameter to plpgsql trigger
Следующее
От: "Daniel Verite"
Дата:
Сообщение: Re: what is the date format in binary query results