Re: SET WITHOUT OIDS and VACUUM badness?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SET WITHOUT OIDS and VACUUM badness?
Date: 2004-02-11 22:44:10
Message-ID: 200402112244.i1BMiA726804@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gavin Sherry wrote:
> On Wed, 21 Jan 2004, Gavin Sherry wrote:
>
> > On Wed, 21 Jan 2004, Christopher Kings-Lynne wrote:
> >
> > > This is what we did:
> > >
> > > 0. BEGIN;
> > >
> > > 1. ALTER TABLE ... SET WITHOUT OIDS
> >
> > > 12. ROLLBACK;
> > >
> > > 13. VACUUM FULL forums_posts;
> >
> > The problem here is that this conditional doesn't take into account the
> > change in state which the above transaction causes:
> >
> > if (onerel->rd_rel->relhasoids &&
> > !OidIsValid(HeapTupleGetOid(&tuple)))
> >
> > Tuples inserted after step one have no (valid) OID. However, since we
> > rollback, the change to pg_class.relhasoids => 'f' is rolled back. The
> > only solution I can think of is removing the test or storing relhasoids as
> > a per tuple flag (argh).
>
> What am I talking about. Can't we test for:
>
> (&tuple)->t_infomask & HEAP_HASOID
>
> Instead of:
>
> onerel->rd_rel->relhasoids

I can confirm we still have this bug:

test=> CREATE TABLE foo (a INT);
CREATE TABLE
test=> BEGIN;
BEGIN
test=> ALTER TABLE foo SET WITHOUT OIDS;
INSERT INTO foo values (5);
ROLLBACK;

VACUUM FULL foo;
ALTER TABLE
test=> INSERT INTO foo values (5);
INSERT 0 1
test=> ROLLBACK;
ROLLBACK
test=>
test=> VACUUM FULL foo;
WARNING: relation "foo" TID 0/1: OID is invalid
VACUUM

Anyone want to fix it?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message hong.ge 2004-02-11 22:48:51 Re: How can I have 2 completely seperated databases in PostgreSQL?
Previous Message Bruce Momjian 2004-02-11 22:29:09 Re: [BUGS] Bug in pg_autovacuum ?