From 884af67957c542a74bd739b78f4292d9afea028f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 25 Feb 2026 10:57:51 +0100 Subject: [PATCH 09/10] Check for A_Star in transformGraphTablePropertyRef() --- src/backend/parser/parse_graphtable.c | 6 ++++++ src/test/regress/expected/graph_table.out | 5 +++++ src/test/regress/sql/graph_table.sql | 2 ++ 3 files changed, 13 insertions(+) diff --git a/src/backend/parser/parse_graphtable.c b/src/backend/parser/parse_graphtable.c index 0682f27f359..d4fc12f8d02 100644 --- a/src/backend/parser/parse_graphtable.c +++ b/src/backend/parser/parse_graphtable.c @@ -50,6 +50,12 @@ transformGraphTablePropertyRef(ParseState *pstate, ColumnRef *cref) char *elvarname; char *propname; + if (IsA(field1, A_Star) || IsA(field2, A_Star)) + ereport(ERROR, + errcode(ERRCODE_SYNTAX_ERROR), + errmsg("\"*\" not allowed here"), + parser_errposition(pstate, cref->location)); + elvarname = strVal(field1); propname = strVal(field2); diff --git a/src/test/regress/expected/graph_table.out b/src/test/regress/expected/graph_table.out index 547a6b50916..5029d2a7ef7 100644 --- a/src/test/regress/expected/graph_table.out +++ b/src/test/regress/expected/graph_table.out @@ -404,6 +404,11 @@ SELECT * FROM GRAPH_TABLE (g1 MATCH (src IS el1)-[conn]->(dest) COLUMNS (conn.en ERROR: can not find label "el1" in property graph "g1" for element type "vertex" SELECT * FROM GRAPH_TABLE (g1 MATCH (src IS el1 | vl1)-[conn]->(dest) COLUMNS (conn.ename AS cename)); ERROR: can not find label "el1" in property graph "g1" for element type "vertex" +-- star in property reference +SELECT * FROM GRAPH_TABLE (myshop MATCH (c IS customers WHERE c.address = 'US')-[IS customer_orders]->(o IS orders) COLUMNS (c.*)); +ERROR: "*" not allowed here +LINE 1: ... = 'US')-[IS customer_orders]->(o IS orders) COLUMNS (c.*)); + ^ -- select all the properties across all the labels associated with a given type -- of graph element SELECT * FROM GRAPH_TABLE (g1 MATCH (src)-[conn]->(dest) COLUMNS (src.vname AS svname, conn.ename AS cename, dest.vname AS dvname, src.vprop1 AS svp1, src.vprop2 AS svp2, src.lprop1 AS slp1, dest.vprop1 AS dvp1, dest.vprop2 AS dvp2, dest.lprop1 AS dlp1, conn.eprop1 AS cep1, conn.lprop2 AS clp2)); diff --git a/src/test/regress/sql/graph_table.sql b/src/test/regress/sql/graph_table.sql index d94f88ad619..443947ca77e 100644 --- a/src/test/regress/sql/graph_table.sql +++ b/src/test/regress/sql/graph_table.sql @@ -283,6 +283,8 @@ CREATE PROPERTY GRAPH g1 -- el1 is associated with only edges, and cannot qualify a vertex SELECT * FROM GRAPH_TABLE (g1 MATCH (src IS el1)-[conn]->(dest) COLUMNS (conn.ename AS cename)); SELECT * FROM GRAPH_TABLE (g1 MATCH (src IS el1 | vl1)-[conn]->(dest) COLUMNS (conn.ename AS cename)); +-- star in property reference +SELECT * FROM GRAPH_TABLE (myshop MATCH (c IS customers WHERE c.address = 'US')-[IS customer_orders]->(o IS orders) COLUMNS (c.*)); -- select all the properties across all the labels associated with a given type -- of graph element -- 2.53.0