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 1i62G0-0004cL-HK for pgsql-general@arkaria.postgresql.org; Fri, 06 Sep 2019 00:37:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i62Fz-0005ea-0x for pgsql-general@arkaria.postgresql.org; Fri, 06 Sep 2019 00:37:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i62Fy-0005Y1-6W for pgsql-general@lists.postgresql.org; Fri, 06 Sep 2019 00:37:42 +0000 Received: from resqmta-ch2-07v.sys.comcast.net ([2001:558:fe21:29:69:252:207:39]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i62Fu-00072N-Pb for pgsql-general@postgresql.org; Fri, 06 Sep 2019 00:37:41 +0000 Received: from resomta-ch2-01v.sys.comcast.net ([69.252.207.97]) by resqmta-ch2-07v.sys.comcast.net with ESMTP id 62CfiekchvpGJ62FsiaXIr; Fri, 06 Sep 2019 00:37:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=20190202a; t=1567730256; bh=Fbww0id3maTQYISUtCy5zpjwA4gc8mSh3STxSF6hXzs=; h=Received:Received:Received:From:To:Subject:Date:Message-ID: MIME-Version:Content-Type; b=1oG5X9nZjiLd72uQJsD2Vpy7S8tR/hSGaTHdoz/JaBHiFOUVhec/XqsFq7mAf6+sL +6EEoChS5PkvHAUdSPLPma/CdvuzEbj9OJqC6PaNair2Gpp1V/I1M6+D+uhAonMjc7 Sb9eaA8WfCHhRlZb4xFyoNyEIzQlT3vp4v+JwTDoPBG879uwfFaSwugKH7i1OdR2qr Nlcvl9tsThlXukEhW9n8EqiKdm/ogL3k8zW1WXmFxBNsyb/nB3UbGycBMC4tCT7+RS fHQy9DjpQPwURVatIrciiyhutkJqL4yvYipRYHc9+Y1dy1bV/gUqOBE0OosZLCmTfq XJzVcPYtQ4JtQ== Received: from jsievers.comcast.net ([12.187.116.132]) by resomta-ch2-01v.sys.comcast.net with ESMTPA id 62Fji0ChsKYFn62FjiFtK1; Fri, 06 Sep 2019 00:37:33 +0000 X-Xfinity-VAAS: gggruggvucftvghtrhhoucdtuddrgeduvddrudejkedgvddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuvehomhgtrghsthdqtfgvshhipdfqfgfvpdfpqffurfetoffkrfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhfffgjkfgfgggtgfesthhqredttderjeenucfhrhhomheplfgvrhhrhicuufhivghvvghrshcuoehgshhivghvvghrshduleestghomhgtrghsthdrnhgvtheqnecukfhppeduvddrudekjedrudduiedrudefvdenucfrrghrrghmpehhvghlohepjhhsihgvvhgvrhhsrdgtohhmtggrshhtrdhnvghtpdhinhgvthepuddvrddukeejrdduudeirddufedvpdhmrghilhhfrhhomhepghhsihgvvhgvrhhsudelsegtohhmtggrshhtrdhnvghtpdhrtghpthhtohepkhgsrhgrnhhnvghnsegvfhhjihdrtghomhdprhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghlsehpohhsthhgrhgvshhqlhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-Xfinity-VMeta: sc=-100;st=legit Received: from jsievers.enova.com (localhost [127.0.0.1]) by jsievers.comcast.net (Postfix) with ESMTP id 4D66026005A; Thu, 5 Sep 2019 19:37:27 -0500 (CDT) From: Jerry Sievers To: Kevin Brannen Cc: "pgsql-general\@postgresql.org" Subject: Re: pg_restore issues with intarray References: <587d9b02-e4c4-c08e-4b70-169d029bd3e7@aklaver.com> <804d3055-b371-d914-7a77-1b9d8cf703cf@aklaver.com> Date: Thu, 05 Sep 2019 19:37:27 -0500 In-Reply-To: (Kevin Brannen's message of "Fri, 6 Sep 2019 00:05:32 +0000") Message-ID: <87ftla1cqg.fsf@jsievers.enova.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Kevin Brannen writes: >> On 9/5/19 4:24 PM, Adrian Klaver wrote: >> > On 9/5/19 4:06 PM, Kevin Brannen wrote: >> >>> From: Adrian Klaver >> >>> >> >>> On 9/5/19 2:57 PM, Kevin Brannen wrote: >> >>>> I think I need some help to understand what=E2=80=99s going here be= cause I >> >>>> can=E2=80=99t figure it out and google isn=E2=80=99t helping. >> >>>> >> >>>> This is for Pg 9.6.5. (Yes, we are upgrading to 12.x in a few >> >>>> months, or so the plan is.) Pg code came from the community and we >> >>>> compiled it with no changes. This is on Centos 6.7, though I think >> >>>> the OS doesn=E2=80=99t matter. >> >>>> >> >>>> We=E2=80=99re calling pg_restore like: >> >>>> >> >>>> $PGPATH/pg_restore -jobs=3D$NCPU --dbname=3Dx . >> >>>> >> >>>> FWIW, the backup was created with: >> >>>> >> >>>> $PGPATH/pg_dump --clean --create --format=3Dd --jobs=3D$NCPU >> >>>> --file=3D$EXP --dbname=3Dx >> >>> >> >>> The options you are adding for --clean, --create only have meaning >> >>> for plain text dumps. If you want those actions to occur on the >> >>> restore then add them to the pg_restore line. Though if you are >> >>> going to create a new database it will inherit objects from >> >>> template1(as you found below), assuming you have not set WITH >> >>> TEMPLATE to something else. >> >>> >> >> >> >> Good point that I'm not doing plain text dumps. >> >> >> >> Are you saying that my problem is that I need "--clean" on the >> >> pg_restore? > > Not the issue, that made various things worse. :) > >> No, just that if you were expecting the clean to happen on the >> restore you would be disappointed. > > To be crystal clear, on restore I do this from a bash script: > > # move old to the side in case we need this on failure > $PGPATH/psql -d template1 -c "DROP DATABASE IF EXISTS save$db;" > $PGPATH/psql -d template1 -c "ALTER DATABASE $db RENAME TO save$db;" > # restore > $PGPATH/createdb -e -O $dbowner -T template0 $db > $PGPATH/pg_restore $VERBOSE --jobs=3D$NCPU --dbname=3D$db . > > So by using template0, I'm expecting nothing to be there and the restore > to put everything in there I need to get back to the point where the > backup/dump happened. This is why I'm surprised I'm getting this error. > > It feels like the restore is adding the intarray extension, which does a > CREATE OPERATOR FAMILY on its own, then later the restore does CREATE OPE= RATOR > FAMILY on again causing the problem. Yet this doesn't happen on most of o= ur > databases, just a few. It's maddening to me. > I've seen this sort of problem before. It was due to some legacy DBs where I work having a few missing extension membership registrations. pg_dump wants to include any such things in the output which may run afoul of same having been already created by the extension load. HTH --=20 Jerry Sievers Postgres DBA/Development Consulting e: postgres.consulting@comcast.net