laquereric opened a new issue, #2601:
URL: https://github.com/apache/age/issues/2601

   On a build with SIZEOF_DATUM = 4 (the 32-bit support added in #2286; 
PGlite's wasm32 build uses it), MERGE of an edge onto vertices bound by an 
earlier clause stores the edge with start_id and end_id = 0:
   
   ```sql
   SELECT * FROM cypher('g', $$ MERGE (a:N {k:'x'}) MERGE (b:N {k:'y'}) MERGE 
(a)-[:E]->(b) $$) AS (r agtype);
   SELECT * FROM cypher('g', $$ MATCH (a:N {k:'x'}), (b:N {k:'y'}) MERGE 
(a)-[:E]->(b) $$) AS (r agtype);
   ```
   
   The edge row is stored, but no MATCH walks it, and a second MERGE of the 
same edge stores a duplicate (data correctness).
   
   Cause: `path_entry`'s `id`, `start_id` and `end_id` are `graphid` fields, 
but `merge_vertex` and `merge_edge` in `src/backend/executor/cypher_merge.c` 
store Datums in them and read them back as Datums, while `prebuild_path` stores 
real graphids for already-bound vertices. On a 64-bit build the two are the 
same bits; with 4-byte Datums a graphid Datum is a pointer, so the edge is 
written with whatever that address holds.
   
   Found by running one Cypher workload on PostgreSQL 17 (64-bit) and in PGlite 
0.4.6 (wasm32): 606 of 617 statements agreed before the fix, 617 after. A fix 
follows as a pull request.
   


-- 
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]

Reply via email to