You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@age.apache.org by jg...@apache.org on 2021/12/22 00:09:55 UTC

[incubator-age] branch master updated: Corrects abnormal termination due to incorrect variable in Set Clause. (#165)

This is an automated email from the ASF dual-hosted git repository.

jgemignani pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-age.git


The following commit(s) were added to refs/heads/master by this push:
     new c094814  Corrects abnormal termination due to incorrect variable in Set Clause. (#165)
c094814 is described below

commit c0948142f7ed5b3b2b97243292bb38e192af0b25
Author: Alex Kwak <ta...@kakao.com>
AuthorDate: Wed Dec 22 09:09:48 2021 +0900

    Corrects abnormal termination due to incorrect variable in Set Clause. (#165)
    
    Previously, `ColumnRef` may come according to the Parser rule. but, this case is not considered.
    Therefore, add logic to detect these errors.
---
 src/backend/parser/cypher_clause.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/backend/parser/cypher_clause.c b/src/backend/parser/cypher_clause.c
index e833ef3..543fa1a 100644
--- a/src/backend/parser/cypher_clause.c
+++ b/src/backend/parser/cypher_clause.c
@@ -747,10 +747,20 @@ cypher_update_information *transform_cypher_set_item_list(
         TargetEntry *target_item;
         cypher_update_item *item;
         ColumnRef *ref;
-        A_Indirection *ind = (A_Indirection *)set_item->prop;
+        A_Indirection *ind;
         char *variable_name, *property_name;
         Value *property_node, *variable_node;
 
+        // ColumnRef may come according to the Parser rule.
+        if (!IsA(set_item->prop, A_Indirection))
+        {
+            ereport(ERROR,
+                    (errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
+                            errmsg("SET clause expects a variable name"),
+                            parser_errposition(pstate, set_item->location)));
+        }
+
+        ind = (A_Indirection *)set_item->prop;
         item = make_ag_node(cypher_update_item);
 
         if (!is_ag_node(lfirst(li), cypher_set_item))