MuhammadTahaNaveed commented on code in PR #2547:
URL: https://github.com/apache/age/pull/2547#discussion_r4251133342


##########
src/backend/executor/cypher_set.c:
##########
@@ -416,6 +416,10 @@ void apply_update_list(CustomScanState *node,
     HTAB *index_cache = NULL;
     HASHCTL idx_hashctl;
 
+    /* if scanTupleSlot is NULL, there is no data to update */
+    if (scanTupleSlot == NULL)
+        return;

Review Comment:
   This return silently skips a real SET update. In the added test, `r0.k5` 
stays `"x"` instead of becoming `"J"`.
   
   The SET executor's child is a PostgreSQL `Result` node with its input in 
`ecxt_outertuple`. A NULL `ecxt_scantuple` does not mean there is no row to 
update.
   
   This also reproduces without MERGE (PostgreSQL 18.3, `89cb3a8e`):
   
   ```sql
   CREATE EXTENSION IF NOT EXISTS age;
   LOAD 'age';
   SET search_path = ag_catalog, public;
   SELECT create_graph('set_repro');
   
   SELECT * FROM cypher('set_repro', $$
     CREATE (:base {id: 1})-[:r {k0: false}]->
            (:base {id: 2})-[:s {k5: 'x'}]->(:base {id: 3})
   $$) AS (v agtype);
   
   SELECT * FROM cypher('set_repro', $$
     MATCH (a:base)-[r1:r]->(n:base)-[r0:s]->(b:base)
     SET r0.k5 = 'J', r1.k0 = true
     WITH range(0, 0) + [0] AS keep, r1 AS old
     WHERE 0 IN keep
     DELETE old
     CREATE (:x)
     RETURN 1
   $$) AS (v agtype);
   
   SELECT * FROM cypher('set_repro', $$
     MATCH (:base {id: 2})-[r:s]->(:base {id: 3})
     RETURN r.k5
   $$) AS (value agtype);
   -- Expected: "J"
   -- Actual:   "x"
   ```
   
   Please fix SET's input-slot handling and have the regression check the 
stored property before dropping the graph.



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