diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2025-05-19 18:50:26 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2025-05-19 18:50:26 +0300 |
commit | 29f7ce6fe78e3f8d520764b5870453d791a3ca65 (patch) | |
tree | 0f97e4b1b38000881700002bd350e36de7c0d4a4 /src/backend/regex/regex2.h | |
parent | ad5eaf390c58294e2e4c1509aa87bf13261a5d15 (diff) | |
download | postgresql-29f7ce6fe78e3f8d520764b5870453d791a3ca65.tar.gz postgresql-29f7ce6fe78e3f8d520764b5870453d791a3ca65.zip |
Fix deparsing FETCH FIRST <expr> ROWS WITH TIES
In the grammar, <expr> is a c_expr, which accepts only a limited set
of integer literals and simple expressions without parens. The
deparsing logic didn't quite match the grammar rule, and failed to use
parens e.g. for "5::bigint".
To fix, always surround the expression with parens. Would be nice to
omit the parens in simple cases, but unfortunately it's non-trivial to
detect such simple cases. Even if the expression is a simple literal
123 in the original query, after parse analysis it becomes a FuncExpr
with COERCE_IMPLICIT_CAST rather than a simple Const.
Reported-by: yonghao lee
Backpatch-through: 13
Discussion: https://www.postgresql.org/message-id/18929-077d6b7093b176e2@postgresql.org
Diffstat (limited to 'src/backend/regex/regex2.h')
0 files changed, 0 insertions, 0 deletions