From 4641bbc2fd6bdd8813cd70af524382ddd03ef961 Mon Sep 17 00:00:00 2001
From: Rui Zhao <zhaorui126@gmail.com>
Date: Sun, 30 Aug 2026 00:36:16 +0800
Subject: [PATCH] Add an error position to the element pattern quantifier error

transformGraphElementPattern() has gep->location at hand, and the other
not-supported errors in this file already report a position.  The
existing regression test at graph_table.sql:94 picks up the LINE output.
---
 src/backend/parser/parse_graphtable.c     | 3 ++-
 src/test/regress/expected/graph_table.out | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/backend/parser/parse_graphtable.c b/src/backend/parser/parse_graphtable.c
index 1514baf4b96..8a0b29476dd 100644
--- a/src/backend/parser/parse_graphtable.c
+++ b/src/backend/parser/parse_graphtable.c
@@ -247,7 +247,8 @@ transformGraphElementPattern(ParseState *pstate, GraphElementPattern *gep)
 	if (gep->quantifier)
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("element pattern quantifier is not supported")));
+				 errmsg("element pattern quantifier is not supported"),
+				 parser_errposition(pstate, gep->location)));
 
 	Assert(!gpstate->cur_gep);
 
diff --git a/src/test/regress/expected/graph_table.out b/src/test/regress/expected/graph_table.out
index 7c78d7883c7..b546085d8ab 100644
--- a/src/test/regress/expected/graph_table.out
+++ b/src/test/regress/expected/graph_table.out
@@ -105,6 +105,8 @@ LINE 1: SELECT * FROM GRAPH_TABLE (myshop MATCH COLUMNS (1 AS col));
                                                 ^
 SELECT customer_name FROM GRAPH_TABLE (myshop MATCH (c IS customers)->{1,2}(o IS orders) COLUMNS (c.name AS customer_name));  -- error
 ERROR:  element pattern quantifier is not supported
+LINE 1: ...me FROM GRAPH_TABLE (myshop MATCH (c IS customers)->{1,2}(o ...
+                                                             ^
 SELECT * FROM GRAPH_TABLE (myshop MATCH ((c IS customers)->(o IS orders)) COLUMNS (c.name));
 ERROR:  unsupported element pattern kind: "nested path pattern"
 LINE 1: SELECT * FROM GRAPH_TABLE (myshop MATCH ((c IS customers)->(...
-- 
2.43.7

