Serial and triggers - Mailing list pgsql-novice

From Lan Barnes
Subject Serial and triggers
Date
Msg-id 20060908224115.GA20121@falleagle.net
Whole thread Raw
Responses Re: Serial and triggers
Re: Serial and triggers
List 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 by date:

Previous
From: Cyrus Downey
Date:
Subject: Re: Insert Only Postgresql [VASCL:A10A18D3590]
Next
From: Sean Davis
Date:
Subject: Re: Serial and triggers