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+tgmoythtzzf6yhnq22szpw7otit68iu9wvvidb2jz50kd...@mail.gmail.com [2] — http://www.postgresql.org/message-id/15208.1285772...@sss.pgh.pa.us Cheers, Roma
fix_drop_operator_reset_oprcom_and_oprnegate_fields_v1.patch
Description: Binary data
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers