Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f9PFYFP09884 for ; Thu, 25 Oct 2001 11:34:15 -0400 (EDT) (envelope-from josh@agliodbs.com) Received: from [209.10.40.250] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.4.7) with HTTP id 492038; Thu, 25 Oct 2001 08:34:09 -0700 From: "Josh Berkus" Subject: Re: GUID in postgres To: Horst Herb , pgsql-sql@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.4.7 Date: Thu, 25 Oct 2001 08:34:09 -0700 Message-ID: In-Reply-To: <20011025034926.30847.qmail@gnumed.dhs.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="_===492038====davinci.ethosmedia.com===_" X-Archive-Number: 200110/357 X-Sequence-Number: 5310 This is a multi-part MIME message --_===492038====davinci.ethosmedia.com===_ Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit Horst, > What we are using is the following: > - All tables in need of a global ID _within_ a database inherit a > globid > table which contains nothing but an ID of type serial. > - When we need cross-database unique IDs within the same system, the > globid > table contains a database identifier as well (like the OID of the > pg_database > entry for the database). Well, I think you've just answered your own question. Build the above. In more specific: 1. PostgreSQL does not, as a design decision, support inter-database queries. So an inter-database ID is not particularly useful. 2. If you needed an id to be unique between servers for some reason, simply make it a two-column ID: one column for the sequence (see below) and one for the server name/ID 3. Sequences are guarenteed unique within a database up to the limits of INT4 (2.4 billion). Read up on them in the postgreSQL docs. Also see my posts on pgsql-sql for the last week regarding primary keys. -Josh Berkus ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco --_===492038====davinci.ethosmedia.com===_ Content-Type: text/plain Content-Disposition: attachment; filename="" Content-Transfer-Encoding: base64 DQo= --_===492038====davinci.ethosmedia.com===_ Content-Type: text/plain Content-Disposition: attachment; filename="" Content-Transfer-Encoding: base64 DQo= --_===492038====davinci.ethosmedia.com===_ Content-Type: text/plain Content-Disposition: attachment; filename="" Content-Transfer-Encoding: base64 DQo= --_===492038====davinci.ethosmedia.com===_--