Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TlU3s-0002RB-KA for pgsql-bugs@arkaria.postgresql.org; Thu, 20 Dec 2012 00:32:32 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TlU3s-0004XQ-4y for pgsql-bugs@arkaria.postgresql.org; Thu, 20 Dec 2012 00:32:32 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TlU3r-0004XL-HM for pgsql-bugs@postgresql.org; Thu, 20 Dec 2012 00:32:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TlU3q-0007KH-7i for pgsql-bugs@postgresql.org; Thu, 20 Dec 2012 00:32:30 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id qBK0WHfN025924; Wed, 19 Dec 2012 19:32:17 -0500 (EST) From: Tom Lane To: Daniel Migowski cc: "pgsql-bugs@postgresql.org" Subject: Re: BUG #7758: pg_dump does not correctly dump operators. In-reply-to: <41ED3F5450C90F4D8381BC4D8DF6BBDC729C317D@EXCHANGESERVER.ikoffice.de> References: <20158.1355944125@sss.pgh.pa.us> <41ED3F5450C90F4D8381BC4D8DF6BBDC729C317D@EXCHANGESERVER.ikoffice.de> Comments: In-reply-to Daniel Migowski message dated "Wed, 19 Dec 2012 19:28:41 +0000" Date: Wed, 19 Dec 2012 19:32:17 -0500 Message-ID: <25923.1355963537@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Daniel Migowski writes: > DROP OPERATOR IF EXISTS #<#(text,text) CASCADE; > CREATE OPERATOR #<#( > PROCEDURE = text_natsort_lt, > LEFTARG = text, > RIGHTARG = text, > COMMUTATOR = #>#, > RESTRICT = scalarltsel, > JOIN = scalarltjoinsel); > DROP OPERATOR IF EXISTS #>#(text,text) CASCADE; > CREATE OPERATOR #>#( > PROCEDURE = text_natsort_gt, > LEFTARG = text, > RIGHTARG = text, > COMMUTATOR = #<#, > RESTRICT = scalargtsel, > JOIN = scalargtjoinsel); The second DROP removes the "shell" operator that was created as a placeholder by the first operator's COMMUTATOR reference. Then when you create the #># operator for real, it's not linked to the #<# operator, at least not in that direction. pg_dump is not at fault here; it's just reporting what's in the catalogs, which is to say a dangling commutator link. I believe we've looked at this in the past, and not found any cure that wasn't worse than the disease. For example, if we were to treat the first operator's COMMUTATOR reference as a hard dependency, then the second DROP CASCADE would cascade to remove the first operator, hardly the outcome you'd want. My recommendation for the moment is that if you want to write the script in this style, put all the DROPs first and then create the operators. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs