Serial and triggers

Поиск
Список
Период
Сортировка
От Lan Barnes
Тема Serial and triggers
Дата
Msg-id 20060908224115.GA20121@falleagle.net
обсуждение исходный текст
Ответы Re: Serial and triggers  (Sean Davis <sdavis2@mail.nih.gov>)
Re: Serial and triggers  (Steve Crawford <scrawford@pinpointresearch.com>)
Список pgsql-novice
I have come to the conclusion that the serial data type is inadequate
for providing a reliable unique record number on inserts. The final
sticking point is that after restoring (or replicating) a data base from
a pg_dump, the seed number for the serial value isn't updated and I get
dupe numbers.

To compensate for this, I want to add a code snippet on inserts that
checks for the high number in the unique number field, increments it,
and inserts. However, it seems to me that this snippet should be an
insert trigger so that I don't have to promulgate it to all clients,
present and future.

Because this is NOVICE I have no trouble admitting I have no trigger
experience. However, before I get into it, I want to ask if this is
already available on some contrib forum.

TIA,

--
Lan Barnes
Linux Guy, SCM Specialist
Tcl/Tk Enthusiast

Let me take this opportunity to dispel the notion, the canard,
that scientists are against transcendentalism, ... particularly
intelligent design. If any positive evidence could be found of a
supernatural guiding force, there would be a land rush of
scientists into it.
                          - Edward O. Wilson


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

Предыдущее
От: Cyrus Downey
Дата:
Сообщение: Re: Insert Only Postgresql [VASCL:A10A18D3590]
Следующее
От: Sean Davis
Дата:
Сообщение: Re: Serial and triggers