From d8672633f3ca2ce3d7c9aedc0a59e108528bca2f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 25 Feb 2026 11:05:53 +0100 Subject: [PATCH 10/10] Add error location and improve error code --- src/backend/parser/parse_graphtable.c | 5 +++-- src/test/regress/expected/graph_table.out | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/backend/parser/parse_graphtable.c b/src/backend/parser/parse_graphtable.c index d4fc12f8d02..dcaf15bd44f 100644 --- a/src/backend/parser/parse_graphtable.c +++ b/src/backend/parser/parse_graphtable.c @@ -68,8 +68,9 @@ transformGraphTablePropertyRef(ParseState *pstate, ColumnRef *cref) pgptup = SearchSysCache2(PROPGRAPHPROPNAME, ObjectIdGetDatum(gpstate->graphid), CStringGetDatum(propname)); if (!HeapTupleIsValid(pgptup)) ereport(ERROR, - errcode(ERRCODE_SYNTAX_ERROR), - errmsg("property \"%s\" does not exist", propname)); + errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("property \"%s\" does not exist", propname), + parser_errposition(pstate, cref->location)); pgpform = (Form_pg_propgraph_property) GETSTRUCT(pgptup); gpr->location = cref->location; diff --git a/src/test/regress/expected/graph_table.out b/src/test/regress/expected/graph_table.out index 5029d2a7ef7..565c7caea82 100644 --- a/src/test/regress/expected/graph_table.out +++ b/src/test/regress/expected/graph_table.out @@ -87,6 +87,8 @@ LINE 1: ...US')-[IS customer_orders]->(o IS orders) COLUMNS (cx.name AS... ^ SELECT customer_name FROM GRAPH_TABLE (myshop MATCH (c IS customers WHERE c.address = 'US')-[IS customer_orders]->(o IS orders) COLUMNS (c.namex AS customer_name)); -- error ERROR: property "namex" does not exist +LINE 1: ...US')-[IS customer_orders]->(o IS orders) COLUMNS (c.namex AS... + ^ SELECT customer_name FROM GRAPH_TABLE (myshop MATCH (c IS customers|employees WHERE c.address = 'US')-[IS customer_orders]->(o IS orders) COLUMNS (c.name AS customer_name)); -- error ERROR: label "employees" does not exist in property graph "myshop" SELECT customer_name FROM GRAPH_TABLE (myshop MATCH (c IS customers WHERE c.address = 'US')-[IS customer_orders] COLUMNS (c.name AS customer_name)); -- error -- 2.53.0