From: | Lan Barnes <lan(at)falleagle(dot)net> |
---|---|
To: | Postgres Newbie <pgsql-novice(at)postgresql(dot)org> |
Subject: | Serial and triggers |
Date: | 2006-09-08 22:41:15 |
Message-ID: | 20060908224115.GA20121@falleagle.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Steve Crawford | 2006-09-09 00:11:01 | Re: Serial and triggers |
Previous Message | Karen Hill | 2006-09-08 21:48:13 | Re: Insert Only Postgresql |