Re: pg_upgrade relation OID mismatches - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: pg_upgrade relation OID mismatches
Date
Msg-id 201111252005.pAPK59v01915@momjian.us
Whole thread Raw
In response to Re: pg_upgrade relation OID mismatches  (Bruce Momjian <bruce@momjian.us>)
Responses Re: pg_upgrade relation OID mismatches
List pgsql-hackers
Bruce Momjian wrote:
> Bruce Momjian wrote:
> > Heikki Linnakangas wrote:
> > > On 24.11.2011 07:01, Bruce Momjian wrote:
> > > > Bruce Momjian wrote:
> > > >> OK, that is a heap table.  My only guess is that the heap is being
> > > >> created without binary_upgrade_next_heap_pg_class_oid being set.
> > > >> Looking at the code, I can't see how the heap could be created without
> > > >> this happening.  Another idea is that pg_dumpall isn't output the proper
> > > >> value, but again, how is this data type different from the others.
> > > >
> > > > I have reproduced the failure and found it was code I added to pg_dump
> > > > back in 9.0.  The code didn't set the index oid for exclusion constraint
> > > > indexes.  Once these were added to the regression tests for range types
> > > > recently, pg_upgrade threw an error.
> > > >
> > > > My assumption is that anyone trying to use an exclusion constraint with
> > > > pg_upgrade will get the same type of error.
> > > >
> > > > Patch attached.  Should it be backpatched to 9.0 and 9.1?
> > > 
> > > If I understood correctly, pg_upgrade of a database with exclusion 
> > > constraints won't work without this patch? In that case, it should be 
> > > backpatched.
> > 
> > Yes, that is my guess.  I will test it today or tomorrow.  I am
> > surprised we had _no_ exclusion constraint tests in the regression tests
> > until now.
> 
> I do see EXCLUDE constraints in 9.0, so I need to do some more research:
> 
>     CREATE TABLE circles (
>       c1 CIRCLE,
>       c2 TEXT,
>       EXCLUDE USING gist
>         (c1 WITH &&, (c2::circle) WITH &&)
>         WHERE (circle_center(c1) <> '(0,0)')
>     );
> 
> It seems it is only the range-type EXCLUDE constraints that are causing
> a problem.

OK, it turns out that exclusion contraints used in pre-9.2 regression
tests were deleted before the regression tests finished, which means
they were not tested by me.  (This might be a good reason _not_ to have
the regression tests removing objects before the scripts exit.)

I have applied the posted patch to 9.0, 9.1, and 9.2.  The good news is
that no one reported this failure in the field, and it would have
generated an error, rather than silently failing.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


pgsql-hackers by date:

Previous
From: Jeff Janes
Date:
Subject: Re: [PATCH] optional cleaning queries stored in pg_stat_statements
Next
From: Alvaro Herrera
Date:
Subject: Re: pg_upgrade relation OID mismatches