Fix pg_get_ruledef() so that negative numeric constants are parenthesized.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 6 Jun 2008 18:00:09 +0000 (18:00 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 6 Jun 2008 18:00:09 +0000 (18:00 +0000)
commitd326a6ee2c7864ce9c4e2a1324c009be3f1b8e46
tree81f90e806289578d21347e91f8e6a3d271e93f22
parent95d855dfff296a73429142cd0df8a012142f0328
Fix pg_get_ruledef() so that negative numeric constants are parenthesized.
This is needed because :: casting binds more tightly than minus, so for
example -1::integer is not the same as (-1)::integer, and there are cases
where the difference is important.  In particular this caused a failure
in SELECT DISTINCT ... ORDER BY ... where expressions that should have
matched were seen as different by the parser; but I suspect that there
could be other cases where failure to parenthesize leads to subtler
semantic differences in reloaded rules.  Per report from Alexandr Popov.
src/backend/utils/adt/ruleutils.c