jrgemignani commented on code in PR #1885:
URL: https://github.com/apache/age/pull/1885#discussion_r1605319814
##########
src/backend/parser/cypher_clause.c:
##########
@@ -1836,27 +1837,59 @@ cypher_update_information
*transform_cypher_set_item_list(
((cypher_map*)set_item->expr)->keep_null = set_item->is_add;
}
- // create target entry for the new property value
- item->prop_position = (AttrNumber)pstate->p_next_resno;
- target_item = transform_cypher_item(cpstate, set_item->expr, NULL,
- EXPR_KIND_SELECT_TARGET, NULL,
- false);
-
- if (has_a_cypher_list_comprehension_node(set_item->expr))
+ /*
+ * if the RHS is a ColumnRef and the TargetEntry for the variable
+ * already exists, no need to transform the RHS item,
+ * just add volatile wrapper to the target entry of the existing item
+ */
+ if (IsA(set_item->expr, ColumnRef))
{
- query->hasAggs = true;
Review Comment:
Was this intentionally removed?
##########
src/backend/parser/cypher_clause.c:
##########
@@ -1836,27 +1837,59 @@ cypher_update_information
*transform_cypher_set_item_list(
((cypher_map*)set_item->expr)->keep_null = set_item->is_add;
}
- // create target entry for the new property value
- item->prop_position = (AttrNumber)pstate->p_next_resno;
- target_item = transform_cypher_item(cpstate, set_item->expr, NULL,
- EXPR_KIND_SELECT_TARGET, NULL,
- false);
-
- if (has_a_cypher_list_comprehension_node(set_item->expr))
+ /*
+ * if the RHS is a ColumnRef and the TargetEntry for the variable
+ * already exists, no need to transform the RHS item,
+ * just add volatile wrapper to the target entry of the existing item
+ */
+ if (IsA(set_item->expr, ColumnRef))
{
- query->hasAggs = true;
+ ColumnRef *cref = (ColumnRef *)set_item->expr;
+ String *cref_str = linitial(cref->fields);
+ char *prop_name = cref_str->sval;
+
+ int prop_resno = get_target_entry_resno(query->targetList,
prop_name);
+
+ if (prop_resno != -1)
+ {
+ // RHS variable already exists
+ rhs_var_exists = true;
+ item->prop_position = prop_resno;
+ target_item = findTarget(query->targetList, prop_name);
+ add_volatile_wrapper_to_target_entry(query->targetList,
+ item->prop_position);
+ }
}
- if (!query->hasAggs && nodeTag(target_item->expr) == T_Aggref)
Review Comment:
Same question
--
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]