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: 0001-Add-a-test-for-the-property-error-message-with-two-p.patch
Description: Binary data

Attachment: 0002-Add-an-error-position-to-the-element-pattern-quantif.patch
Description: Binary data

Reply via email to