Skip to content

Quote operator names when restoring them after CREATE/DROP OPERATOR - #419

Open
youdie006 wants to merge 1 commit into
darold:masterfrom
youdie006:quote-restored-operator
Open

youdie006 wants to merge 1 commit into
darold:masterfrom
youdie006:quote-restored-operator

Conversation

@youdie006

Copy link
Copy Markdown

_restore_operator() puts the operator name into the substitution pattern without escaping it, so names containing ?, | or * are read as a regex. CREATE OPERATOR ?| (...) turns into an empty alternation and inserts ?| between every character of the output, ? becomes ???, and <| becomes <||<|; DROP OPERATOR is affected the same way (hstore's install script no longer parses after formatting).

This uses \Q...\E, as _quote_operator() already does. Added t/test-files/ex89.sql and updated four regression goldens (create_operator, drop_operator, privileges, tsrf) that had recorded the mangled names. All 74 operator names from pg_operator.dat now survive CREATE/DROP OPERATOR unchanged. prove -l t/ and t/regress_test.pl pass.

If #418 lands first, the test count in t/02_regress.t needs one more bump; I can rebase.

Written with AI assistance (Claude); I have reviewed the change.

_restore_operator() put the name into the substitution pattern without
escaping it, so names with ?, | or * were read as a regex.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant