Coerce GRAPH_TABLE pattern WHERE clauses to boolean

transformGraphElementPattern() and transformGraphPattern() ran their
WHERE clauses through transformExpr() without ever applying
coerce_to_boolean(), so a WHERE clause of any type was accepted and
its bare datum was used as the qual, which resulted in wrong results
without a diagnostic.  Route both sites through
transformWhereClause(), like every other WHERE clause, and add
regression tests for the element-level and pattern-level cases.

Author: Ewan Young <[email protected]>
Reviewed-by: Chao Li <[email protected]>
Discussion: 
https://www.postgresql.org/message-id/flat/CAON2xHNZUS8ZwzVEJFeRirsC_-7EJvdbwABSzdGaJ_DF9DvHoQ%40mail.gmail.com

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1c8c790ec104bbef338eb52a9dc17030cee7c82e

Modified Files
--------------
src/backend/parser/parse_graphtable.c     | 7 +++++--
src/test/regress/expected/graph_table.out | 4 ++++
src/test/regress/sql/graph_table.sql      | 2 ++
3 files changed, 11 insertions(+), 2 deletions(-)

Reply via email to