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

   ### Configuration
   
   - Docker images: `apache/age:release_PG18_1.8.0` 
(`sha256:47a0b054c3663a3e64a25fc0c5a982f1b58348019274b326a691cdf77f78eb58`, 
PostgreSQL 18.6) and `apache/age:dev_snapshot_master` 
(`sha256:dd7d8f022a70cb2331e863998f30b7c0311d32e7c3f6816c7dc5fee448da2341`, 
built 2026-11-23, PostgreSQL 18.7)
   - AGE extension version: 1.8.0
   - Platform: linux/arm64
   - Query interface: `psql`
   
   ### Description
   
   An expression in `MERGE`'s `ON MATCH SET` or `ON CREATE SET` that reads the 
merged entity fails:
   
   ```text
   ERROR:  attribute 1 of type record has wrong type
   DETAIL:  Table has type agtype, but query expects vertex.
   ```
   
   A constant in the same action works, and so does the same expression in a 
plain `SET` after the `MERGE`.
   
   ### Steps to reproduce
   
   ```sql
   LOAD 'age';
   SET search_path = ag_catalog, "$user", public;
   SELECT create_graph('repro2');
   SELECT * FROM cypher('repro2', $$ CREATE (:T {id: 1, c: 5, name: 'a'}) $$) 
AS (r agtype);
   
   -- Fail
   SELECT * FROM cypher('repro2', $$ MERGE (n:T {id: 1}) ON MATCH SET n.c = n.c 
+ 1 $$) AS (r agtype);
   SELECT * FROM cypher('repro2', $$ MERGE (n:T {id: 1}) ON MATCH SET n.c = n.c 
+ 1 RETURN n.c $$) AS (c agtype);
   SELECT * FROM cypher('repro2', $$ MERGE (n:T {id: 1}) ON MATCH SET n.copy = 
n.name $$) AS (r agtype);
   SELECT * FROM cypher('repro2', $$ MERGE (n:T {id: 2}) ON CREATE SET n.copy = 
n.id $$) AS (r agtype);
   
   -- Work
   SELECT * FROM cypher('repro2', $$ MERGE (n:T {id: 1}) ON MATCH SET n.c = 7 
$$) AS (r agtype);
   SELECT * FROM cypher('repro2', $$ MERGE (n:T {id: 1}) SET n.c = n.c + 1 $$) 
AS (r agtype);
   ```
   
   ### Expected and actual behaviour
   
   Expected is what Neo4j 5.26.34 Community returns for the same Cypher.
   
   | Statement | Expected (Neo4j 5.26) | Actual (AGE 1.8.0 and master) |
   | --- | --- | --- |
   | `ON MATCH SET n.c = n.c + 1` | `c = 6` | the error above |
   | The same with `RETURN n.c` | `6` | the error above |
   | `ON MATCH SET n.copy = n.name` | `copy = 'a'` | the error above |
   | `ON CREATE SET n.copy = n.id`, creating the vertex | `copy = 2` | the 
error above |
   | `ON MATCH SET n.c = 7` | `c = 7` | `c = 7` |
   | `MERGE … SET n.c = n.c + 1` | adds 1 | adds 1 |
   
   Both images give identical output. The failing statements roll back, so 
nothing is written.
   
   ### Related
   
   `ON CREATE SET n.firstseen = timestamp()` and other constants work. The 
other defect in the same area, a `SET` after these actions being silently 
dropped, is in #2629.
   


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