From 1f794225a703b655d08a35dcfa92355dc440da0c Mon Sep 17 00:00:00 2001
From: Rui Zhao <zhaorui126@gmail.com>
Date: Sun, 30 Aug 2026 00:08:20 +0800
Subject: [PATCH] Add a test for the property error message with two property
 graphs

The graph name added to the message in v2 is there to disambiguate when
a query references more than one property graph.  Add a regression test
exercising exactly that: node_id resolves in myshop but not in myshop2,
and the error names myshop2.
---
 src/test/regress/expected/graph_table.out | 7 +++++++
 src/test/regress/sql/graph_table.sql      | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/src/test/regress/expected/graph_table.out b/src/test/regress/expected/graph_table.out
index 445cbbd0ef6..7c78d7883c7 100644
--- a/src/test/regress/expected/graph_table.out
+++ b/src/test/regress/expected/graph_table.out
@@ -1074,6 +1074,13 @@ SELECT * FROM customers_us_redacted;
  redacted1
 (1 row)
 
+-- with multiple property graph references in the query, the error message
+-- identifies the graph the property is missing from (node_id exists in
+-- myshop but nowhere in myshop2)
+SELECT * FROM GRAPH_TABLE (myshop MATCH (c IS customers) COLUMNS (c.name AS n1)) g1, GRAPH_TABLE (myshop2 MATCH (o IS orders) COLUMNS (o.node_id AS n2)) g2;  -- error
+ERROR:  property "node_id" does not exist in property graph "myshop2"
+LINE 1: ...GRAPH_TABLE (myshop2 MATCH (o IS orders) COLUMNS (o.node_id ...
+                                                             ^
 -- GRAPH_TABLE in UDFs
 CREATE FUNCTION out_degree(sname varchar) RETURNS varchar AS $$
 DECLARE
diff --git a/src/test/regress/sql/graph_table.sql b/src/test/regress/sql/graph_table.sql
index 21e70015f6e..357f5ea8383 100644
--- a/src/test/regress/sql/graph_table.sql
+++ b/src/test/regress/sql/graph_table.sql
@@ -602,6 +602,11 @@ CREATE VIEW customers_us_redacted AS SELECT * FROM GRAPH_TABLE (myshop2 MATCH (c
 
 SELECT * FROM customers_us_redacted;
 
+-- with multiple property graph references in the query, the error message
+-- identifies the graph the property is missing from (node_id exists in
+-- myshop but nowhere in myshop2)
+SELECT * FROM GRAPH_TABLE (myshop MATCH (c IS customers) COLUMNS (c.name AS n1)) g1, GRAPH_TABLE (myshop2 MATCH (o IS orders) COLUMNS (o.node_id AS n2)) g2;  -- error
+
 -- GRAPH_TABLE in UDFs
 CREATE FUNCTION out_degree(sname varchar) RETURNS varchar AS $$
 DECLARE
-- 
2.43.7

