From d18ec594b5ca5336d291a5d1fc947e010354dc8a Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Date: Fri, 27 Feb 2026 22:25:12 +0530
Subject: [PATCH v20260227 2/2] Simplify property not found error message

---
 src/backend/rewrite/rewriteGraphTable.c   |  4 ++--
 src/test/regress/expected/graph_table.out | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/backend/rewrite/rewriteGraphTable.c b/src/backend/rewrite/rewriteGraphTable.c
index 682ee518ec9..6bfc462be4c 100644
--- a/src/backend/rewrite/rewriteGraphTable.c
+++ b/src/backend/rewrite/rewriteGraphTable.c
@@ -1119,8 +1119,8 @@ replace_property_refs_mutator(Node *node, struct replace_property_refs_context *
 		if (!n)
 			ereport(ERROR,
 					errcode(ERRCODE_UNDEFINED_OBJECT),
-					errmsg("none of the property graph elements associated with variable \"%s\" have property with name \"%s\" defined",
-						   mapping_factor->variable, get_propgraph_property_name(gpr->propid)));
+					errmsg("property \"%s\" for element variable \"%s\" not found",
+						   get_propgraph_property_name(gpr->propid), mapping_factor->variable));
 
 		return n;
 	}
diff --git a/src/test/regress/expected/graph_table.out b/src/test/regress/expected/graph_table.out
index ee778e9cc31..237e8cacf7a 100644
--- a/src/test/regress/expected/graph_table.out
+++ b/src/test/regress/expected/graph_table.out
@@ -224,7 +224,7 @@ SELECT * FROM GRAPH_TABLE (myshop MATCH (c IS customers)-[IS customer_orders | c
 
 -- property not associated with labels queried results in error
 SELECT * FROM GRAPH_TABLE (myshop MATCH (c IS customers)-[IS customer_orders | customer_wishlists ]->(l IS orders | wishlists)-[ IS list_items]->(p IS products) COLUMNS (c.name AS customer_name, p.name AS product_name, l.list_type)) ORDER BY 1, 2, 3;
-ERROR:  none of the property graph elements associated with variable "l" have property with name "list_type" defined
+ERROR:  property "list_type" for element variable "l" not found
 -- vertex to vertex connection abbreviation
 SELECT * FROM GRAPH_TABLE (myshop MATCH (c IS customers)->(o IS orders) COLUMNS (c.name, o.ordered_when)) ORDER BY 1;
    name    | ordered_when 
@@ -398,13 +398,13 @@ SELECT * FROM GRAPH_TABLE (g1 MATCH (v1 IS vl2)-(v2) COLUMNS (v1.vname AS v1name
 -- Errors
 -- vl1 is not associated with property vprop2
 SELECT src, src_vprop2, conn, dest FROM GRAPH_TABLE (g1 MATCH (a IS vl1)-[b IS el1]->(c IS vl2 | vl3) COLUMNS (a.vname AS src, a.vprop2 AS src_vprop2, b.ename AS conn, c.vname AS dest));
-ERROR:  none of the property graph elements associated with variable "a" have property with name "vprop2" defined
+ERROR:  property "vprop2" for element variable "a" not found
 -- property ename is associated with edge labels but not with a vertex label
 SELECT * FROM GRAPH_TABLE (g1 MATCH (src)-[conn]->(dest) COLUMNS (src.vname AS svname, src.ename AS sename));
-ERROR:  none of the property graph elements associated with variable "src" have property with name "ename" defined
+ERROR:  property "ename" for element variable "src" not found
 -- vname is associated vertex labels but not with an edge label
 SELECT * FROM GRAPH_TABLE (g1 MATCH (src)-[conn]->(dest) COLUMNS (conn.vname AS cvname, conn.ename AS cename));
-ERROR:  none of the property graph elements associated with variable "conn" have property with name "vname" defined
+ERROR:  property "vname" for element variable "conn" not found
 -- 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));
 ERROR:  no property graph element of type "vertex" has label "el1" associated with it in property graph "g1"
@@ -772,7 +772,7 @@ EXECUTE loopstmt;
 
 ALTER PROPERTY GRAPH g1 ALTER EDGE TABLE e3_3 ALTER LABEL l2 DROP PROPERTIES (elname);
 EXECUTE loopstmt; -- error
-ERROR:  none of the property graph elements associated with variable "e" have property with name "elname" defined
+ERROR:  property "elname" for element variable "e" not found
 ALTER PROPERTY GRAPH g1 ALTER EDGE TABLE e3_3 ALTER LABEL l2 ADD PROPERTIES ((ename || '_new')::varchar(10) AS elname);
 EXECUTE loopstmt;
    loop   
-- 
2.34.1

