| From: | Rui Zhao <zhaorui126(at)gmail(dot)com> |
|---|---|
| To: | Sami Imseih <samimseih(at)gmail(dot)com> |
| Cc: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Fix GRAPH TABLE label and property error reporting |
| Date: | 2026-08-29 16:49:10 |
| Message-ID: | CAHWVJhGUtcO1zkfPHY8ODa48W6Q88qTwJJKhY-jJW-uXyNWmUA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Sami,
I tested v2 on master (07fdee7c8a8). It applies cleanly, make check passes
(243/243, graph_table included), and both lookups now report SQLSTATE 42704
with an error position.
1. The case that motivated adding the graph name -- more than one property
graph referenced in the query -- has no regression coverage; the error
tests all reference a single graph. 0001 attached (on top of v2) adds
one, reusing myshop and myshop2 (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 ...
-- ^
2. I also tried a label disjunction to see whether the caret finds the
label that actually failed to resolve -- v2 reports the right error:
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: 42704: label "employees" does not exist in property graph "myshop"
-- LINE 1: ...me FROM GRAPH_TABLE (myshop MATCH (c IS customers|employees ...
-- ^
3. The rewrite-time lookups already use ERRCODE_UNDEFINED_OBJECT when a
property exists in the graph but does not resolve for the element
(replace_property_refs_mutator(), rewriteGraphTable.c:1145; likewise the
label-association error at :990):
SELECT * FROM GRAPH_TABLE (myshop MATCH (c IS customers) COLUMNS
(c.ordered_when AS x));
-- ERROR: 42704: property "ordered_when" for element variable "c" not found
so with v2 the parse-time and rewrite-time classification agree.
4. One more ereport in parse_graphtable.c could take a position while at
it -- the quantifier check in transformGraphElementPattern(), where
gep->location is already available. 0002 attached adds it; the existing
test at graph_table.sql:94 then shows the position:
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 ...
-- ^
Regards,
Rui Zhao
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Add-a-test-for-the-property-error-message-with-two-p.patch | application/octet-stream | 2.4 KB |
| 0002-Add-an-error-position-to-the-element-pattern-quantif.patch | application/octet-stream | 2.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Sehrope Sarkuni | 2026-08-29 16:57:00 | [PATCH] Fix getopt_long() argument handling and add tests |
| Previous Message | Bharath Rupireddy | 2026-08-29 15:58:03 | REPACK (CONCURRENTLY) fails with wrong error for materialized views |