Re: Rule/sequence weirdness

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Rule/sequence weirdness
Дата
Msg-id 413588B2.6070708@archonet.com
обсуждение исходный текст
Ответ на Rule/sequence weirdness  (Steve Crawford <scrawford@pinpointresearch.com>)
Список pgsql-general
Steve Crawford wrote:
>
> I want to monitor inserts to table "foo":
> guid: integer not null default nextval('public.guid'::text)
> end_time: integer
[snip]
> I expected the guid to match. Unfortunately there are no matching
> guids between the two tables. It appears that the sequence is being
> called twice so the guid in the log table is one greater than the
> guid in the main table.
>
> Did I miss something in my rule logic or is this a bug?

Rules are simply macros, so you are right and the sequence will be
accessed twice. You'll want to look at triggers.

--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: John Sidney-Woollett
Дата:
Сообщение: Re: Suppress output from psql?
Следующее
От: Daniel Schuchardt
Дата:
Сообщение: Re: Exporting/moving Postgress Instance