Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i5srW-0005l2-Ja for pgsql-general@arkaria.postgresql.org; Thu, 05 Sep 2019 14:35:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i5srV-0003DI-DD for pgsql-general@arkaria.postgresql.org; Thu, 05 Sep 2019 14:35:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i5srU-000362-Th for pgsql-general@lists.postgresql.org; Thu, 05 Sep 2019 14:35:49 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i5srO-00077l-J2 for pgsql-general@postgresql.org; Thu, 05 Sep 2019 14:35:47 +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 x85EZbSp023540; Thu, 5 Sep 2019 10:35:37 -0400 From: Tom Lane To: Lele Gaifax cc: pgsql-general@postgresql.org Subject: Re: Cannot restore dump when using IS DISTINCT FROM on a HSTORE column In-reply-to: <87woem4ymk.fsf@metapensiero.it> References: <87woem4ymk.fsf@metapensiero.it> Comments: In-reply-to Lele Gaifax message dated "Thu, 05 Sep 2019 16:16:19 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23538.1567694137.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 05 Sep 2019 10:35:37 -0400 Message-ID: <23539.1567694137@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Lele Gaifax 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 g= et the > same error: "ERROR: operator does not exist: public.hstore =3D public.h= store". > 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 o= ne > year old, I wonder if there is any news on this, or alternatively if the= re 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