Re: BUG #7758: pg_dump does not correctly dump operators.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Migowski <dmigowski(at)ikoffice(dot)de>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #7758: pg_dump does not correctly dump operators.
Date: 2012-12-20 00:32:17
Message-ID: 25923.1355963537@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Daniel Migowski <dmigowski(at)ikoffice(dot)de> 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2012-12-20 00:36:16 Re: BUG #7758: pg_dump does not correctly dump operators.
Previous Message Daniel Migowski 2012-12-19 19:28:41 Re: BUG #7758: pg_dump does not correctly dump operators.