On Wed, Sep 03, 2003 at 01:05:30PM +0200, Malcolm Warren wrote: > I agree with you about database design and in fact fortunately I don't use > oids as foreign keys, which I thought unwise. However I have found oids very > useful as temporary unique references to a record in my programming. If I > had known when I started writing my code three years ago that there was even > the slightest doubt about continuing with oids then I wouldn't have used > them.
You can create tables WITH OIDS (this is by default on 7.3, but will probably changed in some future release). If you also create an unique index on the oid column of the table, you have all you need. But beware that some INSERTs will fail because the OID counter will wrap around at some point. There is a non-zero probability that the newly generated OID will collide with an existing tuple in that table; you have to be prepared to repeat your query in that case, which can be a pain if you are doing something else in the same transaction. -- Alvaro Herrera (<[EMAIL PROTECTED]>) "Lo esencial es invisible para los ojos" (A. de Saint Exúpery) ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html