Re: Is it safe to use DEFAULT currval()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Is it safe to use DEFAULT currval()
Дата
Msg-id 6626.1064684440@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Is it safe to use DEFAULT currval()  (Richard Huxton <dev@archonet.com>)
Ответы Re: Is it safe to use DEFAULT currval()
Список pgsql-general
Richard Huxton <dev@archonet.com> writes:
> CREATE TABLE foo (
>   id       SERIAL,
>   blah     text,
>   tracking int4 DEFAULT currval('foo_id_seq')
>   PRIMARY KEY (id)
> );

> Now - it works, but is that a design feature or just luck?

You're essentially assuming that the column expressions for an INSERT
will be evaluated left-to-right.  That's true at the moment, and I don't
see any foreseeable reason why we'd change it, but it surely is an
implementation dependency that could bite you someday.

            regards, tom lane

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

Предыдущее
От: Andre Truter
Дата:
Сообщение: Re: PostgreSQL Delphi
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Is it safe to use DEFAULT currval()