ALTER TABLE .. < ADD | DROP > OIDS

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: Pgsql Performance <pgsql-performance(at)postgresql(dot)org>
Subject: ALTER TABLE .. < ADD | DROP > OIDS
Date: 2002-12-06 04:11:45
Message-ID: 1039147904.72042.71.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

I wish to create an alter command which will allow a table to have OIDs
added or removed.

The tricky part appears to be changing the tuples themselves. I believe
if I pull the same trick that cluster does (create new file, copy
tuples, etc) it can be done fairly easily.

First, set up pg_class appropriately (oid flag).

Second, copy out tuples from oldfile to newfile, running a
heap_deformtuple() -> heap_formtuple() process on each. Since
heap_deformtuple only deals with positive numbered attributes
(non-system attributes) this should be safe to do on a mis-configured
relation. heap_formtuple completes the dirty work of setting up the OID
column appropriately.

--
Rod Taylor <rbt(at)rbt(dot)ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Bruce Momjian 2002-12-06 05:00:14 Re: ALTER TABLE .. < ADD | DROP > OIDS
Previous Message Vernon Wu 2002-12-06 00:43:58 Re: Is a better way to have the same result of this