pgsql: Fix cross variable references in graph pattern causing segfault

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема pgsql: Fix cross variable references in graph pattern causing segfault
Дата
Msg-id E1w7VmV-002I3X-0h@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a0dd0702e464f206b08c99a74cb58809c51aafa5

Modified Files
--------------
src/backend/parser/parse_graphtable.c     | 43 ++++++++++++++++++++++++++++---
src/include/parser/parse_node.h           |  3 +++
src/test/regress/expected/graph_table.out | 20 ++++++++++++++
src/test/regress/sql/graph_table.sql      |  8 ++++++
4 files changed, 71 insertions(+), 3 deletions(-)


В списке pgsql-committers по дате отправления: