Re: A bug with ALTER TABLE SET WITHOUT OIDS in CVS HEAD

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: A bug with ALTER TABLE SET WITHOUT OIDS in CVS HEAD
Date: 2008-11-05 23:38:52
Message-ID: 4646.1225928332@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
> This patch:

>> As noted by Andrew Gierth, there's really no need any more to force a junk
>> filter to be used when INSERT or SELECT INTO has a plan that returns raw
>> disk tuples.

> made this test case crash:

> CREATE TABLE xtable (padding char(2000)) WITH OIDS;
> INSERT INTO xtable VALUES('1');
> ALTER TABLE xtable SET WITHOUT OIDS;
> INSERT INTO xtable (SELECT * FROM xtable);

Hmm, that's kinda ugly. The real reason there's a problem, IMHO,
is that the table contains tuples that don't match the rowtype
specification. We've tried to skate around this and pretend that
SET WITHOUT OIDS is cost-free, but it really isn't. I think this
bug needs to be regarded as a member of a class of probable bugs,
not an isolated error.

Could we get away with turning SET WITHOUT OIDS into a table-rewriting
operation that physically gets rid of the OIDs? The default has been
no-oids for long enough that I'm not convinced that we need to risk more
bugs in the name of keeping it a low-cost operation. (I note that we
could then also support SET WITH OIDS with about the same infrastructure.)

The alternative would probably be to treat a dropped OID column more
like a dropped user column, including an explicit mark in the catalogs
that "this table used to have OIDs" and special-casing all over the
place. Doesn't seem attractive.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alex Hunsaker 2008-11-05 23:57:07 Re: RAM-only temporary tables
Previous Message Bernd Helmle 2008-11-05 23:12:31 Re: Patch for ALTER DATABASE WITH TABLESPACE