Fix cross variable references in graph pattern causing segfault
Peter Eisentraut <peter@eisentraut.org>
Author:
Peter Eisentraut <peter@eisentraut.org>
Date: 2026-03-31T09:47:19Z
Releases:
19 (unreleased)
Fix cross variable references in graph pattern causing segfault When converting the WHERE clause in an element pattern, generate_query_for_graph_path() calls replace_property_refs() to replace the property references in it. Only the current graph element pattern is passed as the context for replacement. If there are references to variables from other element patterns, it causes a segmentation fault (an assertion failure in an Assert enabled build) since it does not find path_element object corresponding to those variables. We do not support forward and backward variable references within a graph table clause. Hence prohibit all the cross references. Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> Reported-by: Man Zeng <zengman@halodbtech.com> Reviewed-by: Henson Choi <assam258@gmail.com> Reviewed-by: Junwang Zhao <zhjwpku@gmail.com> Discussion: https://www.postgresql.org/message-id/CAExHW5u6AoDfNg4%3DR5eVJn_bJn%3DC%3DwVPrto02P_06fxy39fniA%40mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/parser/parse_graphtable.c | modified | +40 −3 |
| src/include/parser/parse_node.h | modified | +3 −0 |
| src/test/regress/expected/graph_table.out | modified | +20 −0 |
| src/test/regress/sql/graph_table.sql | modified | +8 −0 |
Discussion
- SQL Property Graph Queries (SQL/PGQ) 211 messages · 2024-02-16 → 2026-05-16