Re: pg_upgrade error regarding hstore operator

From: "Feld, Michael (IMS)" <FeldM(at)imsweb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_upgrade error regarding hstore operator
Date: 2016-04-06 20:21:22
Message-ID: 15c0241a4a14409d9bda8c29a9673d68@NAIAD.omni.imsweb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Thanks for the assist Tom. That worked for us. Noticing a different issue following the pg_upgrade. If we take a pg_dump of a database on this upgraded instance with the hstore extension and try to pg_restore it back up to the same instance we get the following errors (ignore the likeness to your name, apparently when this cluster was created years ago they chose to set it up in your honor):

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 3879; 2753 745119 OPERATOR FAMILY btree_ hstore_ops tomlane
pg_restore: [archiver (db)] could not execute query: ERROR: operator family "btree_hstore_ops" for access method "btree" already exists
Command was: CREATE OPERATOR FAMILY btree_hstore_ops USING btree;

pg_restore: [archiver (db)] Error from TOC entry 3880; 2753 745127 OPERATOR FAMILY gin_hs tore_ops tomlane
pg_restore: [archiver (db)] could not execute query: ERROR: operator family "gin_hstore_ops" for access method "gin" already exists
Command was: CREATE OPERATOR FAMILY gin_hstore_ops USING gin;

pg_restore: [archiver (db)] Error from TOC entry 3881; 2753 745137 OPERATOR FAMILY gist_h store_ops tomlane
pg_restore: [archiver (db)] could not execute query: ERROR: operator family "gist_hstore_ops" for access method "gist" already exists
Command was: CREATE OPERATOR FAMILY gist_hstore_ops USING gist;

pg_restore: [archiver (db)] Error from TOC entry 3882; 2753 745151 OPERATOR FAMILY hash_h store_ops tomlane
pg_restore: [archiver (db)] could not execute query: ERROR: operator family "hash_hstore_ops" for access method "hash" already exists
Command was: CREATE OPERATOR FAMILY hash_hstore_ops USING hash;

We do not have this issue for any new databases created following the pg_upgrade. I noticed that new databases have the hstore 1.3 version while the originals still have the 1.1 version. I updated the extension on one of these to see if that would resolve the issue and it did not. Thanks for any help you can offer.

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Tuesday, March 08, 2016 6:22 PM
To: Feld, Michael (IMS) <FeldM(at)imsweb(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] pg_upgrade error regarding hstore operator

"Feld, Michael (IMS)" <FeldM(at)imsweb(dot)com> writes:
> I am attempting to upgrade my organization's database cluster from
> 9.1.19 to 9.5.1 using the pg_upgrade utility.

That's kind of a big jump :-( ... you missed the versions where => was deprecated as an operator name.

> I tried dropping the operator before doing the upgrade but it's dependent on the existence of the hstore extension. Ideas?

The clean solution would be to copy share/extension/hstore--1.0--1.1.sql
from the 9.5 installation into the 9.1 installation and then do

ALTER EXTENSION hstore UPDATE TO '1.1';

Under the hood that's just doing

ALTER EXTENSION hstore DROP OPERATOR => (text, text); DROP OPERATOR => (text, text);

but if you did that manually, you'd have a problem when you want to update hstore to current versions later. If you do what I suggest, the extension will properly look like it's 1.1 after pg_upgrade'ing.

regards, tom lane

________________________________

Information in this e-mail may be confidential. It is intended only for the addressee(s) identified above. If you are not the addressee(s), or an employee or agent of the addressee(s), please note that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender of the error.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alan Hodgson 2016-04-06 20:48:49 Re: Problem after replication switchover
Previous Message DrakoRod 2016-04-06 19:03:21 Re: I can't see wal receiver process in one node

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2016-04-06 20:33:19 Re: IF (NOT) EXISTS in psql-completion
Previous Message David Rowley 2016-04-06 20:01:21 Re: Performance improvement for joins where outer side is unique