[GENERAL] looking for a globally unique row ID - Mailing list pgsql-general

From Rafal Pietrak
Subject [GENERAL] looking for a globally unique row ID
Date
Msg-id 560176cd-db03-ae60-5718-6878c6f27c7b@ztk-rp.eu
Whole thread Raw
Responses Re: [GENERAL] looking for a globally unique row ID  (John R Pierce <pierce@hogranch.com>)
Re: [GENERAL] looking for a globally unique row ID  (Michael Paquier <michael.paquier@gmail.com>)
Re: [GENERAL] looking for a globally unique row ID  (Merlin Moncure <mmoncure@gmail.com>)
Re: [GENERAL] looking for a globally unique row ID  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general
Hello everybody,

Can anybody help me find a way to implement an ID which:

1. guarantees being unique across multiple tables.

2. guarantees its uniqueness not only during INSERT, but also during the
lifetime of the database/application (e.i. during future UPDATES).

3. guarantees persistence of value across database backup/restore/upgrade.

an obvious candidate - a single SERIAL() (same serial) used in every
table that needs that ID does not guarantee (2).

on the other hand having a dedicated table just for the purpose of
holding that UNIQUE column with all the "client tables" having FK
pointing to it does not guarantee that multiple "client tables" want use
the same ID from that table. ... and I don't know a way to make an FK
"backfireing" from that table into a multitude of client tables.

I thought of using OIDs on tables that need this unique ID ... but
querying the web returns warnings of OID "rollover" problem. As I'm not
quite sure how to manage that, and if (3) is guaranteed (not just being
lucky during couple of tests), I think this is not an option here.

I'd appreciate any hints, as I'm bitting my head against this problem
for a long time, now.

Thenx in advance,

-R


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

pgsql-general by date:

Previous
From: George Neuner
Date:
Subject: Re: [GENERAL] equivalent for md5, clobs and varchar2 list
Next
From: John R Pierce
Date:
Subject: Re: [GENERAL] looking for a globally unique row ID