Re: [GENERAL] using ID as a key - Mailing list pgsql-general

From Sevo Stille
Subject Re: [GENERAL] using ID as a key
Date
Msg-id 389EBA3F.D5F54037@ip23.net
Whole thread Raw
In response to Re: [GENERAL] using ID as a key  (davidb@vectormath.com)
Responses Re: [GENERAL] using ID as a key
List pgsql-general
davidb@vectormath.com wrote:
>
> Hi Sheila,
>
> For general database design considerations (not specific to Postgres) I
> disagree with the others on the use of serials and sequences.  These
> things never migrate well from platform to platform, they often break, and
> dealing with them is a nightmare if you ever have to do any bulk data
> copying.
> ID generation ought to be handled programmatically.

At the server? This is what OIDs do - alas, these are even less portable
than serials and sequences. At the client interface? Nice, as long as
you have a single user database. In a multiuser environment, generating
and maintaining a unique ID externally to the database is close to
impossible. Simply incrementing the highest available ID from the
database by one is error prone, even if you catch duplicate insertions
by making the ID field UNIQUE and incrementing the ID in a loop until
you succeed - a slow client in a heavily updated database might
permanently fail to insert his record before the generated ID is used by
some other, faster client. And generating unique IDs based on an
database-independent would require some synchronized mechanism for ID
generation, adding dependency on the ID source to dependency on the
database.


Sevo

--
Sevo Stille
sevo@ip23.net

pgsql-general by date:

Previous
From: "Matthias Zehnder"
Date:
Subject: limits for a text field
Next
From: Karl DeBisschop
Date:
Subject: Re: [GENERAL] using ID as a key(REPOST)