Skip site navigation (1) Skip section navigation (2)

Re: surrogate key or not?

From: Rod Taylor <pg(at)rbt(dot)ca>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Iain <iain(at)mst(dot)co(dot)jp>, Markus Bertheau <twanger(at)bluetwanger(dot)de>,pgsql-sql(at)postgresql(dot)org
Subject: Re: surrogate key or not?
Date: 2004-07-21 15:10:51
Message-ID: 1090422650.21450.13.camel@jester (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
> All three of these implementation issues are, at least in theory, 
> surmountable.   For example, Sybase overcame problems (1) and (3) by creating 
> an automated, system-controlled hash key based on the table's real key.  This 
> was a solution endorsed by E.F. Codd in the mid-90's when he came to regret 
> his promotion of the "Primary Key" idea in the SQL standard.  

I've often wondered if the OID was intended to be something similar. 

You specify:

	CREATE TABLE abc (key varchar(120) PRIMARY KEY);
	CREATE TABLE bcd (key varchar(120) REFERENCES abc);

PostgreSQL was actually supposed to create:

	abc(oid oid, key varchar(120) PRIMARY KEY);
	bcd(key oid REFERENCES abc(oid));

Then muck around with the queries to resolve the actual varchar() name
when required.

In response to

pgsql-sql by date

Next:From: Geoff RichardsDate: 2004-07-21 15:28:19
Subject: Re: MySQL-style "create temporary table foo select ..."
Previous:From: Javier Tesis Tolosa TrabajoDate: 2004-07-21 15:08:46
Subject: Sorry too many conecctions

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group