aboutsummaryrefslogtreecommitdiff
path: root/src/backend/regex/regexec.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-08-18 18:12:51 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2021-08-18 18:12:51 -0400
commitecd4dd9f1df00ef9e872a4d13bbbe3f3d8d3f966 (patch)
treed0a7e87ddc7cfbeafbbb7c55ae5d4fc66ed979ca /src/backend/regex/regexec.c
parent7b01246e1de94a436c64f1d396674b2dc44dab70 (diff)
downloadpostgresql-ecd4dd9f1df00ef9e872a4d13bbbe3f3d8d3f966.tar.gz
postgresql-ecd4dd9f1df00ef9e872a4d13bbbe3f3d8d3f966.zip
Fix check_agg_arguments' examination of aggregate FILTER clauses.
Recursion into the FILTER clause was mis-implemented, such that a relevant Var or Aggref at the very top of the FILTER clause would be ignored. (Of course, that'd have to be a plain boolean Var or boolean-returning aggregate.) The consequence would be mis-identification of the correct semantic level of the aggregate, which could lead to not-per-spec query behavior. If the FILTER expression is an aggregate, this could also lead to failure to issue an expected "aggregate function calls cannot be nested" error, which would likely result in a core dump later on, since the planner and executor aren't expecting such cases to appear. The root cause is that commit b560ec1b0 blindly copied some code that assumed it's recursing into a List, and thus didn't examine the top-level node. To forestall questions about why this call doesn't look like the others, as well as possible future copy-and-paste mistakes, let's change all three check_agg_arguments_walker calls in check_agg_arguments, even though only the one for the filter clause is really broken. Per bug #17152 from Zhiyong Wu. This has been wrong since we implemented FILTER, so back-patch to all supported versions. (Testing suggests that pre-v11 branches manage to avoid crashing in the bad-Aggref case, thanks to "redundant" checks in ExecInitAgg. But I'm not sure how thorough that protection is, and anyway the wrong-behavior issue remains, so fix 9.6 and 10 too.) Discussion: https://postgr.es/m/17152-c7f906cc1a88e61b@postgresql.org
Diffstat (limited to 'src/backend/regex/regexec.c')
0 files changed, 0 insertions, 0 deletions