From: | Roma Sokolov <sokolov(dot)r(dot)v(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Cc: | Женя Зайцев <zevlg(at)yandex(dot)ru> |
Subject: | [PATCH] fix DROP OPERATOR to reset links to itself on commutator and negator |
Date: | 2016-02-26 15:46:13 |
Message-ID: | A0DF8607-A1A1-40CE-B152-82FC91EF8A3A@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello, hackers!
As was mentioned in that message [1], and earlier in [2], DROPping OPERATOR with
negator or commutator doesn't update respective fields (oprnegate and oprcom) on
them. While this issue is probably not very frequent, this behaviour leaves
database in inconsistent state and prevents from using former negator or
commutator.
Proposed patch fixes unwanted behaviour by reseting oprnegate and oprcom fields
to InvalidOid when deleting operator. Code updates tries to update other
operators only if necessary, and only if negator or commutator have target oid
in their respective fields.
To implement desired behaviour with as little code as possible, OperatorUpd
function is extended to accept additional parameter and made externally visible.
It's used from RemoveOperatorById, after checking that update is indeed needed.
Regression tests are added to check DROP OPERATOR behaves as intended (including
case with self-commutator and unlikely case with operator being both negator and
commutator).
Should this patch be added to CommitFest?
[1] — http://www.postgresql.org/message-id/CA+TgmoYThtZZf6yhnq22SZPw7OTiT68iu9wvvidb2Jz50KdAnQ@mail.gmail.com
[2] — http://www.postgresql.org/message-id/15208.1285772173@sss.pgh.pa.us
Cheers,
Roma
Attachment | Content-Type | Size |
---|---|---|
fix_drop_operator_reset_oprcom_and_oprnegate_fields_v1.patch | application/octet-stream | 17.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2016-02-26 15:57:17 | Re: Performance degradation in commit 6150a1b0 |
Previous Message | Kartyshov Ivan | 2016-02-26 15:45:14 | proposal: get oldest LSN - function |