pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Lele Gaifax <lele@metapensiero.it>
Cc: pgsql-general@postgresql.org
Subject: Re: Cannot restore dump when using IS DISTINCT FROM on a HSTORE column
Date: Thu, 05 Sep 2019 10:35:37 -0400
Message-ID: <23539.1567694137@sss.pgh.pa.us> (raw)
In-Reply-To: <87woem4ymk.fsf@metapensiero.it>
References: <87woem4ymk.fsf@metapensiero.it>

Lele Gaifax <lele@metapensiero.it> writes:
> I'm hitting a problem very similar to the one described here[1]

Yeah, nothing's been done about that yet :-(

> where several of those columns are HSTOREs. Trying to restore a dump I get the
> same error: "ERROR:  operator does not exist: public.hstore = public.hstore".
> The source and target PG versions are the same, 11.5.
> I followed the link[2] and read the related thread: as it is more that one
> year old, I wonder if there is any news on this, or alternatively if there is
> a recommended workaround:

Probably the simplest solution is to override pg_dump's forcing of the
search_path.  It's going to look like this:

SELECT pg_catalog.set_config('search_path', '', false);

If you have the dump in a text file you could just edit it and remove
that line (it's only about a dozen lines in, typically).  Otherwise
you could delete it with sed or the like, roughly

pg_restore dumpfile | sed s'/^SELECT pg_catalog.set_config('search_path', '', false);//' | psql targetdb

There's been some discussion of providing a simpler way to do this,
but nothing's been done about that either.

Disclaimer: in principle, doing this leaves you open to SQL-injection-like
attacks during the restore, if some malicious user has had access to
either the original source database or your restore target DB.  That's
why we put in the search_path restriction.  But it doesn't help to be
secure if you can't get your work done ...

			regards, tom lane





view thread (5+ messages)  latest in thread

Message-ID: <23539.1567694137@sss.pgh.pa.us>
Permalink:  ../23539.1567694137@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23539.1567694137@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, lele@metapensiero.it
  Subject: Re: Cannot restore dump when using IS DISTINCT FROM on a HSTORE column
  In-Reply-To: <23539.1567694137@sss.pgh.pa.us>
  References: <87woem4ymk.fsf@metapensiero.it> <23539.1567694137@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox