gregfelice commented on issue #2490:
URL: https://github.com/apache/age/issues/2490#issuecomment-5169431971
The query as filed **passes on current `master`** — but it is masked rather
than fixed, so I would not close this without linking it to the underlying
defect.
**Environment:** `master` @ 80141740 (1.8.0), PostgreSQL 18.4, built from
source. You filed against 1.7.0.
```
value
--------
"PASS"
(1 row)
```
## Why it passes
The rule that governs this class of bug is that a reading clause sees only
the rows written by the **first input row** of a preceding writing clause. Your
`CREATE (a:N)-[:R {id:1}]->(b:N)` runs from a single input row, so its one edge
falls inside the visible window and the later `MATCH` finds it.
Drive the same shape from two input rows and it still returns the wrong
answer:
```sql
SELECT * FROM cypher('g', $cypher$
UNWIND [1,2] AS i
CREATE (a:N)-[:R {id:i}]->(b:N)
WITH [{id:1},{id:2}] AS items
UNWIND items AS item
MATCH ()-[r:R]->()
WHERE r.id = item.id
RETURN count(r) AS matched
$cypher$) AS (matched agtype);
```
Correct answer is `4` — four input rows reach the `MATCH`, each matching
exactly one edge. Actual is `2`: only the edge created by the first input row
(`id: 1`) is visible, so the two rows carrying `item.id = 2` match nothing.
Both edges do persist.
## Underlying defect
Same root cause as #2493, where I have written it up in full along with the
code references: the snapshot's `curcid` advances once per clause while
`CREATE` consumes one command id per input row, so everything written by input
rows 2..n stays invisible for the remainder of the statement.
Suggest tracking the fix under #2493 and keeping this issue open as the
1.7.0 report until that lands, or closing it with a pointer — whichever the
maintainers prefer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]