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

From Bruce Momjian
Subject Re: pg_upgrade relation OID mismatches
Date
Msg-id 201111240501.pAO51eU05863@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:
> 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?

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
new file mode 100644
index 644637c..6dc3d40
*** a/src/bin/pg_dump/pg_dump.c
--- b/src/bin/pg_dump/pg_dump.c
*************** dumpConstraint(Archive *fout, Constraint
*** 12926,12932 ****
              exit_nicely();
          }

!         if (binary_upgrade && !coninfo->condef)
              binary_upgrade_set_pg_class_oids(q, indxinfo->dobj.catId.oid, true);

          appendPQExpBuffer(q, "ALTER TABLE ONLY %s\n",
--- 12926,12932 ----
              exit_nicely();
          }

!         if (binary_upgrade)
              binary_upgrade_set_pg_class_oids(q, indxinfo->dobj.catId.oid, true);

          appendPQExpBuffer(q, "ALTER TABLE ONLY %s\n",

pgsql-hackers by date:

Previous
From: Greg Smith
Date:
Subject: Re: logging in high performance systems.
Next
From: Alexander Shulgin
Date:
Subject: Re: Notes on implementing URI syntax for libpq