pgsql: Coerce GRAPH_TABLE pattern WHERE clauses to boolean

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Coerce GRAPH_TABLE pattern WHERE clauses to boolean
Date: 2026-09-02 19:14:38
Message-ID: E1x1qPt-00000003DMK-2ouh@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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 <kdbase(dot)hack(at)gmail(dot)com>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2026-09-03 03:17:42 pgsql: Stabilize recovery conflict stats checks in 031_recovery_conflic
Previous Message Tom Lane 2026-09-02 14:53:42 pgsql: Stabilize xid_wraparound/t/002_limits.pl test.