Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VyPkX-0007su-GX for pgsql-general@arkaria.postgresql.org; Wed, 01 Jan 2014 17:38:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VyPkX-0002JM-0n for pgsql-general@arkaria.postgresql.org; Wed, 01 Jan 2014 17:38:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VyPkV-0002JD-Pf for pgsql-general@postgresql.org; Wed, 01 Jan 2014 17:38:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VyPkT-0002Fa-9G for pgsql-general@postgresql.org; Wed, 01 Jan 2014 17:38:31 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s01HcSir027999; Wed, 1 Jan 2014 12:38:28 -0500 From: Tom Lane To: "Reiser, John J." cc: "pgsql-general@postgresql.org" Subject: Re: duplicate OID issue when using pg_upgrade to move from 8.4 to 9.2 In-reply-to: References: Comments: In-reply-to "Reiser, John J." message dated "Wed, 01 Jan 2014 11:53:16 -0500" Date: Wed, 01 Jan 2014 12:38:28 -0500 Message-ID: <27998.1388597908@sss.pgh.pa.us> X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org "Reiser, John J." writes: > I'm working on an upgrade to our database cluster, attempting to move from 8.4 to 9.2. I'm encountering the following error when I attempt the upgrade (in pg_upgrade_restore.log): > CREATE FUNCTION "st_envelope_in"(cstring) RETURNS st_envelope > LANGUAGE "c" IMMUTABLE STRICT > AS 'st_geometry', 'ST_ENVELOPE_In'; > psql:pg_upgrade_dump_db.sql:371910: ERROR: duplicate key value violates unique constraint "pg_type_oid_index" > DETAIL: Key (oid)=(1407909) already exists. What this smells like is a bug in the pg_dump --binary_upgrade logic that tries to preserve type OIDs from the old installation to the new one. Is there a preceding CREATE TYPE command for st_envelope in the dump script? Look for calls to binary_upgrade.set_next_pg_type_oid() and binary_upgrade.set_next_array_pg_type_oid() in the dump script --- are there conflicting entries? Also, exactly what is type 1407909 in the old installation (try "select * from pg_type where oid = 1407909")? > I'm running this on CentOS 6; both 8.4 and 9.2 are installed from the Yum repository. PostgreSQL is primarily used for GIS data and has ESRI st_geometry and PostGIS installed in several of the databases. (ESRI's support is only up to 9.2, which is why I'm not attempting a move to 9.3.) The interesting thing with this error is that when I wipe out the 9.2 data directory, re-initdb, and run the upgrade again, I now get a different error: > CREATE TABLESPACE "sde1" OWNER "sde" LOCATION '/disk2/pgsql/data/sde'; > psql:pg_upgrade_dump_globals.sql:294: ERROR: directory "/disk2/pgsql/data/sde/PG_9.2_201204301" already in use as a tablespace I think that's pilot error: you forgot to clean out tablespace directories along with the main data directory. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general