Re: [PATCH] fix DROP OPERATOR to reset links to itself on commutator and negator

From: Roma Sokolov <sokolov(dot)r(dot)v(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: tomas(dot)vondra(at)2ndquadrant(dot)com, Женя Зайцев <zevlg(at)yandex(dot)ru>
Subject: Re: [PATCH] fix DROP OPERATOR to reset links to itself on commutator and negator
Date: 2016-03-22 23:50:06
Message-ID: A136D245-A2D6-4A19-BCC5-F8B19105B05A@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Tomas, thanks for review and comments!

> I have to admit I find the existing code a bit convoluted, particularly the part that deals with the (commId == negId) case. And the patch does not really improve the situation, quite the contrary.
>
> Perhaps it’s time to get rid of this optimization?

Indeed, code in OperatorUpd is not very easy to read, due to handling this case.
However we can achieve the same results without too much duplication. I have
changed OperatorUpd to perform tuple modification in "lazy" way. Please, check
it out in v4.patch (attached).

> Also, maybe I'm missing something obvious, but it's not immediately obvious to me why we're only checking oprcom and not oprnegate? I.e. why shouldn’t the code be

We do not need to check for operOid != op->oprnegate, since we can't create
operator that is negator to itself. Thus, opnergate either present and differs
from operator being deleted, or is InvalidOid. I have added some clarification
in the comment for future readers.

Fixed style issues as well.

Cheers,
Roma

Attachment Content-Type Size
fix_drop_operator_reset_oprcom_and_oprnegate_fields_v4.patch application/octet-stream 13.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-03-22 23:51:15 Re: Missing rows with index scan when collation is not "C" (PostgreSQL 9.5)
Previous Message Robert Haas 2016-03-22 23:48:31 Re: Missing rows with index scan when collation is not "C" (PostgreSQL 9.5)