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

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


The following commit(s) were added to refs/heads/PG14 by this push:
     new f627679a PG14 Initial version based on master (#1067)
f627679a is described below

commit f627679a5072ae5e43122779c551dd7ab769c2e4
Author: Shoaib <[email protected]>
AuthorDate: Fri Jul 21 21:09:20 2023 +0200

    PG14 Initial version based on master (#1067)
    
    This pull request is a release of the latest version of Apache AGE, which 
is now
    fully compatible with PostgreSQL version 14.
    
    The following changes have been made:
    
    - Source code has been modified where required to ensure compatibility with
      PostgreSQL version 14.
    
    - Regression tests have been updated to accommodate the changes made in
      PostgreSQL version 14 for the infinity data type.
---
 docker/Dockerfile.dev                 |  4 ++--
 regress/expected/expr.out             | 12 ++++++++++--
 src/backend/catalog/ag_catalog.c      |  8 ++++----
 src/backend/commands/label_commands.c | 10 +++++-----
 src/backend/executor/cypher_create.c  | 16 ++++++++--------
 src/backend/executor/cypher_delete.c  |  8 ++++----
 src/backend/executor/cypher_merge.c   | 16 ++++++++--------
 src/backend/executor/cypher_set.c     | 18 +++++++++---------
 src/backend/executor/cypher_utils.c   |  2 +-
 src/backend/parser/cypher_analyze.c   |  8 ++++----
 src/backend/parser/cypher_clause.c    | 26 ++++++++++++++------------
 src/backend/parser/cypher_expr.c      |  4 ++--
 src/backend/parser/cypher_gram.y      |  4 ++--
 src/backend/parser/cypher_item.c      |  2 +-
 src/backend/utils/cache/ag_cache.c    |  4 ++--
 src/backend/utils/graph_generation.c  |  3 +--
 16 files changed, 77 insertions(+), 68 deletions(-)

diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev
index fe40788e..5e47d49b 100644
--- a/docker/Dockerfile.dev
+++ b/docker/Dockerfile.dev
@@ -17,14 +17,14 @@
 #
 
 
-FROM postgres:13-buster
+FROM postgres:14-buster
 
 RUN apt-get update
 RUN apt-get install --assume-yes --no-install-recommends --no-install-suggests 
\
   bison \
   build-essential \
   flex \
-  postgresql-server-dev-13
+  postgresql-server-dev-14
 
 COPY . /age
 
diff --git a/regress/expected/expr.out b/regress/expected/expr.out
index b01cf977..94c8d180 100644
--- a/regress/expected/expr.out
+++ b/regress/expected/expr.out
@@ -1603,11 +1603,19 @@ ERROR:  invalid input syntax for type numeric: "2:71"
 SELECT * FROM cypher('expr', $$
 RETURN ('inf'::numeric)::numeric
 $$) AS r(result agtype);
-ERROR:  invalid input syntax for type numeric: "inf"
+      result       
+-------------------
+ Infinity::numeric
+(1 row)
+
 SELECT * FROM cypher('expr', $$
 RETURN ('infinity'::numeric)::numeric
 $$) AS r(result agtype);
-ERROR:  invalid input syntax for type numeric: "infinity"
+      result       
+-------------------
+ Infinity::numeric
+(1 row)
+
 -- verify that output can be accepted and reproduced correctly via agtype_in
 SELECT agtype_in('2.71::numeric');
    agtype_in   
diff --git a/src/backend/catalog/ag_catalog.c b/src/backend/catalog/ag_catalog.c
index 2004f4d7..f7ed249c 100644
--- a/src/backend/catalog/ag_catalog.c
+++ b/src/backend/catalog/ag_catalog.c
@@ -39,7 +39,7 @@ static bool prev_object_hook_is_set;
 
 static void object_access(ObjectAccessType access, Oid class_id, Oid object_id,
                           int sub_id, void *arg);
-void ag_ProcessUtility_hook(PlannedStmt *pstmt, const char *queryString,
+void ag_ProcessUtility_hook(PlannedStmt *pstmt, const char *queryString, bool 
readOnlyTree,
                             ProcessUtilityContext context, ParamListInfo 
params,
                             QueryEnvironment *queryEnv, DestReceiver *dest,
                             QueryCompletion *qc);
@@ -86,7 +86,7 @@ void process_utility_hook_fini(void)
  * from being thrown, we need to disable the object_access_hook before dropping
  * the extension.
  */
-void ag_ProcessUtility_hook(PlannedStmt *pstmt, const char *queryString,
+void ag_ProcessUtility_hook(PlannedStmt *pstmt, const char *queryString, bool 
readOnlyTree,
                              ProcessUtilityContext context, ParamListInfo 
params,
                              QueryEnvironment *queryEnv, DestReceiver *dest,
                              QueryCompletion *qc)
@@ -94,10 +94,10 @@ void ag_ProcessUtility_hook(PlannedStmt *pstmt, const char 
*queryString,
     if (is_age_drop(pstmt))
         drop_age_extension((DropStmt *)pstmt->utilityStmt);
     else if (prev_process_utility_hook)
-        (*prev_process_utility_hook) (pstmt, queryString, context, params,
+        (*prev_process_utility_hook) (pstmt, queryString, readOnlyTree, 
context, params,
                                       queryEnv, dest, qc);
     else
-        standard_ProcessUtility(pstmt, queryString, context, params, queryEnv,
+        standard_ProcessUtility(pstmt, queryString, readOnlyTree, context, 
params, queryEnv,
                                 dest, qc);
 }
 
diff --git a/src/backend/commands/label_commands.c 
b/src/backend/commands/label_commands.c
index bc0f74c8..6eb991da 100644
--- a/src/backend/commands/label_commands.c
+++ b/src/backend/commands/label_commands.c
@@ -377,7 +377,7 @@ static void create_table_for_label(char *graph_name, char 
*label_name,
     wrapper->stmt_location = -1;
     wrapper->stmt_len = 0;
 
-    ProcessUtility(wrapper, "(generated CREATE TABLE command)",
+    ProcessUtility(wrapper, "(generated CREATE TABLE command)", false,
                    PROCESS_UTILITY_SUBCOMMAND, NULL, NULL, None_Receiver,
                    NULL);
     // CommandCounterIncrement() is called in ProcessUtility()
@@ -524,7 +524,7 @@ static FuncCall *build_id_default_func_expr(char 
*graph_name, char *label_name,
     label_name_const->val.val.str = label_name;
     label_name_const->location = -1;
     label_id_func_args = list_make2(graph_name_const, label_name_const);
-    label_id_func = makeFuncCall(label_id_func_name, label_id_func_args, -1);
+    label_id_func = makeFuncCall(label_id_func_name, label_id_func_args, 
COERCE_SQL_SYNTAX, -1);
 
     //Build a node that will get the next val from the label's sequence
     nextval_func_name = SystemFuncName("nextval");
@@ -538,7 +538,7 @@ static FuncCall *build_id_default_func_expr(char 
*graph_name, char *label_name,
     regclass_cast->arg = (Node *)qualified_seq_name_const;
     regclass_cast->location = -1;
     nextval_func_args = list_make1(regclass_cast);
-    nextval_func = makeFuncCall(nextval_func_name, nextval_func_args, -1);
+    nextval_func = makeFuncCall(nextval_func_name, nextval_func_args, 
COERCE_SQL_SYNTAX, -1);
 
     /*
      * Build a node that constructs the graphid from the label id function
@@ -547,7 +547,7 @@ static FuncCall *build_id_default_func_expr(char 
*graph_name, char *label_name,
     graphid_func_name = list_make2(makeString("ag_catalog"),
                                    makeString("_graphid"));
     graphid_func_args = list_make2(label_id_func, nextval_func);
-    graphid_func = makeFuncCall(graphid_func_name, graphid_func_args, -1);
+    graphid_func = makeFuncCall(graphid_func_name, graphid_func_args, 
COERCE_SQL_SYNTAX, -1);
 
     return graphid_func;
 }
@@ -595,7 +595,7 @@ static Constraint *build_properties_default(void)
     // "ag_catalog"."agtype_build_map"()
     func_name = list_make2(makeString("ag_catalog"),
                            makeString("agtype_build_map"));
-    func = makeFuncCall(func_name, NIL, -1);
+    func = makeFuncCall(func_name, NIL, COERCE_SQL_SYNTAX, -1);
 
     props_default = makeNode(Constraint);
     props_default->contype = CONSTR_DEFAULT;
diff --git a/src/backend/executor/cypher_create.c 
b/src/backend/executor/cypher_create.c
index 560d110b..be7825bf 100644
--- a/src/backend/executor/cypher_create.c
+++ b/src/backend/executor/cypher_create.c
@@ -346,7 +346,7 @@ static void create_edge(cypher_create_custom_scan_state 
*css,
     EState *estate = css->css.ss.ps.state;
     ExprContext *econtext = css->css.ss.ps.ps_ExprContext;
     ResultRelInfo *resultRelInfo = node->resultRelInfo;
-    ResultRelInfo *old_estate_es_result_relation_info = NULL;
+    ResultRelInfo **old_estate_es_result_relations = NULL;
     TupleTableSlot *elemTupleSlot = node->elemTupleSlot;
     TupleTableSlot *scanTupleSlot = econtext->ecxt_scantuple;
     Datum id;
@@ -393,9 +393,9 @@ static void create_edge(cypher_create_custom_scan_state 
*css,
      */
 
     /* save the old result relation info */
-    old_estate_es_result_relation_info = estate->es_result_relation_info;
+    old_estate_es_result_relations = estate->es_result_relations;
 
-    estate->es_result_relation_info = resultRelInfo;
+    estate->es_result_relations = &resultRelInfo;
 
     ExecClearTuple(elemTupleSlot);
 
@@ -422,7 +422,7 @@ static void create_edge(cypher_create_custom_scan_state 
*css,
     insert_entity_tuple(resultRelInfo, elemTupleSlot, estate);
 
     /* restore the old result relation info */
-    estate->es_result_relation_info = old_estate_es_result_relation_info;
+    estate->es_result_relations = old_estate_es_result_relations;
 
     /*
      * When the edge is used by clauses higher in the execution tree
@@ -478,7 +478,7 @@ static Datum create_vertex(cypher_create_custom_scan_state 
*css,
      */
     if (CYPHER_TARGET_NODE_INSERT_ENTITY(node->flags))
     {
-        ResultRelInfo *old_estate_es_result_relation_info = NULL;
+        ResultRelInfo **old_estate_es_result_relations = NULL;
 
         /*
          * Set estate's result relation to the vertex's result
@@ -488,9 +488,9 @@ static Datum create_vertex(cypher_create_custom_scan_state 
*css,
          */
 
         /* save the old result relation info */
-        old_estate_es_result_relation_info = estate->es_result_relation_info;
+        old_estate_es_result_relations = estate->es_result_relations;
 
-        estate->es_result_relation_info = resultRelInfo;
+        estate->es_result_relations = &resultRelInfo;
 
         ExecClearTuple(elemTupleSlot);
 
@@ -509,7 +509,7 @@ static Datum create_vertex(cypher_create_custom_scan_state 
*css,
         insert_entity_tuple(resultRelInfo, elemTupleSlot, estate);
 
         /* restore the old result relation info */
-        estate->es_result_relation_info = old_estate_es_result_relation_info;
+        estate->es_result_relations = old_estate_es_result_relations;
 
         /*
          * When the vertex is used by clauses higher in the execution tree
diff --git a/src/backend/executor/cypher_delete.c 
b/src/backend/executor/cypher_delete.c
index a8300360..68fafae7 100644
--- a/src/backend/executor/cypher_delete.c
+++ b/src/backend/executor/cypher_delete.c
@@ -279,7 +279,7 @@ static agtype_value *extract_entity(CustomScanState *node,
 static void delete_entity(EState *estate, ResultRelInfo *resultRelInfo,
                           HeapTuple tuple)
 {
-    ResultRelInfo *saved_resultRelInfo;
+    ResultRelInfo **saved_resultRels;
     LockTupleMode lockmode;
     TM_FailureData hufd;
     TM_Result lock_result;
@@ -287,8 +287,8 @@ static void delete_entity(EState *estate, ResultRelInfo 
*resultRelInfo,
     Buffer buffer;
 
     // Find the physical tuple, this variable is coming from
-    saved_resultRelInfo = estate->es_result_relation_info;
-    estate->es_result_relation_info = resultRelInfo;
+    saved_resultRels = estate->es_result_relations;
+    estate->es_result_relations = &resultRelInfo;
 
     lockmode = ExecUpdateLockMode(estate, resultRelInfo);
 
@@ -352,7 +352,7 @@ static void delete_entity(EState *estate, ResultRelInfo 
*resultRelInfo,
 
     ReleaseBuffer(buffer);
 
-    estate->es_result_relation_info = saved_resultRelInfo;
+    estate->es_result_relations = saved_resultRels;
 }
 
 /*
diff --git a/src/backend/executor/cypher_merge.c 
b/src/backend/executor/cypher_merge.c
index ab9d4ed9..dbe98851 100644
--- a/src/backend/executor/cypher_merge.c
+++ b/src/backend/executor/cypher_merge.c
@@ -648,7 +648,7 @@ static Datum merge_vertex(cypher_merge_custom_scan_state 
*css,
      */
     if (CYPHER_TARGET_NODE_INSERT_ENTITY(node->flags))
     {
-        ResultRelInfo *old_estate_es_result_relation_info = NULL;
+        ResultRelInfo **old_estate_es_result_relations = NULL;
         Datum prop;
 
         /*
@@ -659,9 +659,9 @@ static Datum merge_vertex(cypher_merge_custom_scan_state 
*css,
          */
 
         /* save the old result relation info */
-        old_estate_es_result_relation_info = estate->es_result_relation_info;
+        old_estate_es_result_relations = estate->es_result_relations;
 
-        estate->es_result_relation_info = resultRelInfo;
+        estate->es_result_relations = &resultRelInfo;
 
         ExecClearTuple(elemTupleSlot);
 
@@ -718,7 +718,7 @@ static Datum merge_vertex(cypher_merge_custom_scan_state 
*css,
         }
 
         /* restore the old result relation info */
-        estate->es_result_relation_info = old_estate_es_result_relation_info;
+        estate->es_result_relations = old_estate_es_result_relations;
 
         /*
          * When the vertex is used by clauses higher in the execution tree
@@ -857,7 +857,7 @@ static void merge_edge(cypher_merge_custom_scan_state *css,
     EState *estate = css->css.ss.ps.state;
     ExprContext *econtext = css->css.ss.ps.ps_ExprContext;
     ResultRelInfo *resultRelInfo = node->resultRelInfo;
-    ResultRelInfo *old_estate_es_result_relation_info = NULL;
+    ResultRelInfo **old_estate_es_result_relations = NULL;
     TupleTableSlot *elemTupleSlot = node->elemTupleSlot;
     Datum id;
     Datum start_id, end_id, next_vertex_id;
@@ -904,9 +904,9 @@ static void merge_edge(cypher_merge_custom_scan_state *css,
      */
 
     /* save the old result relation info */
-    old_estate_es_result_relation_info = estate->es_result_relation_info;
+    old_estate_es_result_relations = estate->es_result_relations;
 
-    estate->es_result_relation_info = resultRelInfo;
+    estate->es_result_relations = &resultRelInfo;
 
     ExecClearTuple(elemTupleSlot);
 
@@ -932,7 +932,7 @@ static void merge_edge(cypher_merge_custom_scan_state *css,
     insert_entity_tuple(resultRelInfo, elemTupleSlot, estate);
 
     /* restore the old result relation info */
-    estate->es_result_relation_info = old_estate_es_result_relation_info;
+    estate->es_result_relations = old_estate_es_result_relations;
 
     /*
      * When the edge is used by clauses higher in the execution tree
diff --git a/src/backend/executor/cypher_set.c 
b/src/backend/executor/cypher_set.c
index 52e16771..4f941bf5 100644
--- a/src/backend/executor/cypher_set.c
+++ b/src/backend/executor/cypher_set.c
@@ -114,9 +114,9 @@ static HeapTuple update_entity_tuple(ResultRelInfo 
*resultRelInfo,
     bool update_indexes;
     TM_Result   result;
     CommandId cid = GetCurrentCommandId(true);
-    ResultRelInfo *saved_resultRelInfo = estate->es_result_relation_info;
+    ResultRelInfo **saved_resultRels = estate->es_result_relations;
 
-    estate->es_result_relation_info = resultRelInfo;
+    estate->es_result_relations = &resultRelInfo;
 
     lockmode = ExecUpdateLockMode(estate, resultRelInfo);
 
@@ -155,7 +155,7 @@ static HeapTuple update_entity_tuple(ResultRelInfo 
*resultRelInfo,
             }
 
             ExecCloseIndices(resultRelInfo);
-            estate->es_result_relation_info = saved_resultRelInfo;
+            estate->es_result_relations = saved_resultRels;
 
             return tuple;
         }
@@ -169,7 +169,7 @@ static HeapTuple update_entity_tuple(ResultRelInfo 
*resultRelInfo,
         // Insert index entries for the tuple
         if (resultRelInfo->ri_NumIndices > 0 && update_indexes)
         {
-          ExecInsertIndexTuples(elemTupleSlot, estate, false, NULL, NIL);
+          ExecInsertIndexTuples(resultRelInfo, elemTupleSlot, estate, false, 
false, NULL, NIL);
         }
 
         ExecCloseIndices(resultRelInfo);
@@ -191,7 +191,7 @@ static HeapTuple update_entity_tuple(ResultRelInfo 
*resultRelInfo,
 
     ReleaseBuffer(buffer);
 
-    estate->es_result_relation_info = saved_resultRelInfo;
+    estate->es_result_relations = saved_resultRels;
 
     return tuple;
 }
@@ -613,12 +613,12 @@ static void process_update_list(CustomScanState *node)
 static TupleTableSlot *exec_cypher_set(CustomScanState *node)
 {
     cypher_set_custom_scan_state *css = (cypher_set_custom_scan_state *)node;
-    ResultRelInfo *saved_resultRelInfo;
+    ResultRelInfo **saved_resultRels;
     EState *estate = css->css.ss.ps.state;
     ExprContext *econtext = css->css.ss.ps.ps_ExprContext;
     TupleTableSlot *slot;
 
-    saved_resultRelInfo = estate->es_result_relation_info;
+    saved_resultRels = estate->es_result_relations;
 
     //Process the subtree first
     Decrement_Estate_CommandId(estate);
@@ -635,7 +635,7 @@ static TupleTableSlot *exec_cypher_set(CustomScanState 
*node)
 
     if (CYPHER_CLAUSE_IS_TERMINAL(css->flags))
     {
-        estate->es_result_relation_info = saved_resultRelInfo;
+        estate->es_result_relations = saved_resultRels;
 
         process_all_tuples(node);
 
@@ -650,7 +650,7 @@ static TupleTableSlot *exec_cypher_set(CustomScanState 
*node)
     /* increment the command counter to reflect the updates */
     CommandCounterIncrement();
 
-    estate->es_result_relation_info = saved_resultRelInfo;
+    estate->es_result_relations = saved_resultRels;
 
     econtext->ecxt_scantuple = ExecProject(node->ss.ps.lefttree->ps_ProjInfo);
 
diff --git a/src/backend/executor/cypher_utils.c 
b/src/backend/executor/cypher_utils.c
index 7b92fbc6..16eb0888 100644
--- a/src/backend/executor/cypher_utils.c
+++ b/src/backend/executor/cypher_utils.c
@@ -254,7 +254,7 @@ HeapTuple insert_entity_tuple_cid(ResultRelInfo 
*resultRelInfo,
     // Insert index entries for the tuple
     if (resultRelInfo->ri_NumIndices > 0)
     {
-        ExecInsertIndexTuples(elemTupleSlot, estate, false, NULL, NIL);
+        ExecInsertIndexTuples(resultRelInfo, elemTupleSlot, estate, false, 
false, NULL, NIL);
     }
 
     return tuple;
diff --git a/src/backend/parser/cypher_analyze.c 
b/src/backend/parser/cypher_analyze.c
index a7895900..a7c31c33 100644
--- a/src/backend/parser/cypher_analyze.c
+++ b/src/backend/parser/cypher_analyze.c
@@ -59,7 +59,7 @@ static void build_explain_query(Query *query, Node 
*explain_node);
 
 static post_parse_analyze_hook_type prev_post_parse_analyze_hook;
 
-static void post_parse_analyze(ParseState *pstate, Query *query);
+static void post_parse_analyze(ParseState *pstate, Query *query, JumbleState 
*jstate);
 static bool convert_cypher_walker(Node *node, ParseState *pstate);
 static bool is_rte_cypher(RangeTblEntry *rte);
 static bool is_func_cypher(FuncExpr *funcexpr);
@@ -88,11 +88,11 @@ void post_parse_analyze_fini(void)
     post_parse_analyze_hook = prev_post_parse_analyze_hook;
 }
 
-static void post_parse_analyze(ParseState *pstate, Query *query)
+static void post_parse_analyze(ParseState *pstate, Query *query, JumbleState 
*jstate)
 {
     if (prev_post_parse_analyze_hook)
     {
-        prev_post_parse_analyze_hook(pstate, query);
+        prev_post_parse_analyze_hook(pstate, query, jstate);
     }
 
     /*
@@ -512,7 +512,7 @@ static void convert_cypher_to_subquery(RangeTblEntry *rte, 
ParseState *pstate)
     if (extra_node == NULL)
     {
         extra_node = llast(stmt);
-        list_delete_ptr(stmt, extra_node);
+        stmt = list_delete_ptr(stmt, extra_node);
     }
     else
     {
diff --git a/src/backend/parser/cypher_clause.c 
b/src/backend/parser/cypher_clause.c
index 81f5cbfc..59af484f 100644
--- a/src/backend/parser/cypher_clause.c
+++ b/src/backend/parser/cypher_clause.c
@@ -595,7 +595,7 @@ static Query *transform_cypher_union(cypher_parsestate 
*cpstate,
 
     nsitem = addRangeTableEntryForJoin(pstate, targetnames, sortnscolumns,
                                        JOIN_INNER, 0, targetvars, NIL, NIL,
-                                       NULL, false);
+                                       NULL, NULL, false);
 
     sv_namespace = pstate->p_namespace;
     pstate->p_namespace = NIL;
@@ -1349,7 +1349,8 @@ static Query *transform_cypher_unwind(cypher_parsestate 
*cpstate,
 
     expr = transform_cypher_expr(cpstate, self->target->val, 
EXPR_KIND_SELECT_TARGET);
 
-    unwind = makeFuncCall(list_make1(makeString("age_unnest")), NIL, -1);
+    unwind = makeFuncCall(list_make1(makeString("age_unnest")), NIL,
+                          COERCE_SQL_SYNTAX, -1);
 
     old_expr_kind = pstate->p_expr_kind;
     pstate->p_expr_kind = EXPR_KIND_SELECT_TARGET;
@@ -1675,7 +1676,7 @@ cypher_update_information *transform_cypher_set_item_list(
                                             makeString("age_properties"));
                 args = list_make1(set_item->expr);
                 set_item->expr = (Node *)makeFuncCall(qualified_name, args,
-                                                      -1);
+                                                      COERCE_SQL_SYNTAX, -1);
             }
         }
         else if (!IsA(set_item->prop, A_Indirection))
@@ -2513,6 +2514,7 @@ static RangeTblEntry 
*transform_cypher_optional_match_clause(cypher_parsestate *
                                         NIL,
                                         NIL,
                                         j->alias,
+                                        NULL,
                                         false);
 
     j->rtindex = jnsitem->p_rtindex;
@@ -3051,7 +3053,7 @@ static FuncCall 
*prevent_duplicate_edges(cypher_parsestate *cpstate,
         }
     }
 
-    return makeFuncCall(qualified_function_name, edges, -1);
+    return makeFuncCall(qualified_function_name, edges, COERCE_SQL_SYNTAX, -1);
 }
 
 /*
@@ -3167,7 +3169,7 @@ static List 
*make_join_condition_for_edge(cypher_parsestate *cpstate,
             args = list_make3(left_id, right_id, entity->expr);
 
             // add to quals
-            quals = lappend(quals, makeFuncCall(qualified_func_name, args, 
-1));
+            quals = lappend(quals, makeFuncCall(qualified_func_name, args, 
COERCE_EXPLICIT_CALL, -1));
         }
 
         /*
@@ -3193,7 +3195,7 @@ static List 
*make_join_condition_for_edge(cypher_parsestate *cpstate,
             args = list_make2(prev_edge->expr, entity->expr);
 
             // create the function call
-            fc = makeFuncCall(qualified_name, args, -1);
+            fc = makeFuncCall(qualified_name, args, COERCE_EXPLICIT_CALL, -1);
 
             quals = lappend(quals, fc);
         }
@@ -3428,7 +3430,7 @@ static List *join_to_entity(cypher_parsestate *cpstate,
         args = list_make3(entity->expr, qual, make_bool_a_const(is_left_side));
 
         // create the function call
-        fc = makeFuncCall(qualified_name, args, -1);
+        fc = makeFuncCall(qualified_name, args, COERCE_EXPLICIT_CALL, -1);
 
         quals = lappend(quals, fc);
 
@@ -3527,7 +3529,7 @@ static A_Expr 
*filter_vertices_on_label_id(cypher_parsestate *cpstate,
     extract_label_id = makeString("_extract_label_id");
 
     fc = makeFuncCall(list_make2(ag_catalog, extract_label_id),
-                      list_make1(id_field), -1);
+                      list_make1(id_field), COERCE_EXPLICIT_CALL, -1);
 
     return makeSimpleA_Expr(AEXPR_OP, "=", (Node *)fc, (Node *)n, -1);
 }
@@ -3973,7 +3975,7 @@ static List *transform_match_entities(cypher_parsestate 
*cpstate, Query *query,
                     targs = lappend(targs, prop_var);
                     fname = list_make2(makeString("ag_catalog"),
                                        makeString("age_properties"));
-                    fc = makeFuncCall(fname, targs, -1);
+                    fc = makeFuncCall(fname, targs, COERCE_SQL_SYNTAX, -1);
 
                     /*
                      * Hand off to ParseFuncOrColumn to create the function
@@ -4102,7 +4104,7 @@ static List *transform_match_entities(cypher_parsestate 
*cpstate, Query *query,
                         targs = lappend(targs, prop_var);
                         fname = list_make2(makeString("ag_catalog"),
                                            makeString("age_properties"));
-                        fc = makeFuncCall(fname, targs, -1);
+                        fc = makeFuncCall(fname, targs, COERCE_SQL_SYNTAX, -1);
 
                         /*
                          * Hand off to ParseFuncOrColumn to create the function
@@ -4356,7 +4358,7 @@ static Node *make_qual(cypher_parsestate *cpstate,
 
 
         args = list_make1(entity->expr);
-        node = (Node *)makeFuncCall(qualified_name, args, -1);
+        node = (Node *)makeFuncCall(qualified_name, args, 
COERCE_EXPLICIT_CALL, -1);
     }
     else
     {
@@ -6103,7 +6105,7 @@ transform_merge_make_lateral_join(cypher_parsestate 
*cpstate, Query *query,
     // make the RTE for the join
     jnsitem = addRangeTableEntryForJoin(pstate, res_colnames, NULL, 
j->jointype,
                                         0, res_colvars, NIL, NIL, j->alias,
-                                        true);
+                                        NULL, true);
 
     j->rtindex = jnsitem->p_rtindex;
 
diff --git a/src/backend/parser/cypher_expr.c b/src/backend/parser/cypher_expr.c
index 31881f26..a5465230 100644
--- a/src/backend/parser/cypher_expr.c
+++ b/src/backend/parser/cypher_expr.c
@@ -289,7 +289,7 @@ static Node *transform_WholeRowRef(ParseState *pstate, 
ParseNamespaceItem *pnsi,
      result->location = location;
 
      /* mark relation as requiring whole-row SELECT access */
-     markVarForSelectPriv(pstate, result, rte);
+     markVarForSelectPriv(pstate, result);
 
      return (Node *)result;
 }
@@ -1054,7 +1054,7 @@ static Node *transform_cypher_typecast(cypher_parsestate 
*cpstate,
     }
 
     /* make a function call node */
-    fnode = makeFuncCall(fname, list_make1(ctypecast->expr),
+    fnode = makeFuncCall(fname, list_make1(ctypecast->expr), COERCE_SQL_SYNTAX,
                          ctypecast->location);
 
     /* return the transformed function */
diff --git a/src/backend/parser/cypher_gram.y b/src/backend/parser/cypher_gram.y
index 901cb6a2..26908122 100644
--- a/src/backend/parser/cypher_gram.y
+++ b/src/backend/parser/cypher_gram.y
@@ -2166,11 +2166,11 @@ static Node *make_function_expr(List *func_name, List 
*exprs, int location)
             funcname = func_name;
 
         /* build the function call */
-        fnode = makeFuncCall(funcname, exprs, location);
+        fnode = makeFuncCall(funcname, exprs, COERCE_SQL_SYNTAX, location);
     }
     /* all other functions are passed as is */
     else
-        fnode = makeFuncCall(func_name, exprs, location);
+        fnode = makeFuncCall(func_name, exprs, COERCE_SQL_SYNTAX, location);
 
     /* return the node */
     return (Node *)fnode;
diff --git a/src/backend/parser/cypher_item.c b/src/backend/parser/cypher_item.c
index 6bcb4783..7d0ad88b 100644
--- a/src/backend/parser/cypher_item.c
+++ b/src/backend/parser/cypher_item.c
@@ -219,7 +219,7 @@ static List *expand_rel_attrs(ParseState *pstate, 
RangeTblEntry *rte,
         te_list = lappend(te_list, te);
 
         /* Require read access to each column */
-        markVarForSelectPriv(pstate, varnode, rte);
+        markVarForSelectPriv(pstate, varnode);
     }
 
     Assert(name == NULL && var == NULL);    /* lists not the same length? */
diff --git a/src/backend/utils/cache/ag_cache.c 
b/src/backend/utils/cache/ag_cache.c
index 7759f56e..a6321620 100644
--- a/src/backend/utils/cache/ag_cache.c
+++ b/src/backend/utils/cache/ag_cache.c
@@ -1159,7 +1159,7 @@ static void *label_seq_name_graph_cache_hash_search(Name 
name, Oid graph,
     label_seq_name_graph_cache_key key;
 
     // initialize the hash key for label_seq_name_graph_cache_hash
-    namecpy(&key.name, name);
+    namestrcpy(&key.name, name->data);
     key.graph = graph;
 
     return hash_search(label_seq_name_graph_cache_hash, &key, action, found);
@@ -1197,5 +1197,5 @@ static void fill_label_cache_data(label_cache_data 
*cache_data,
     // ag_label.seq_name
     value = heap_getattr(tuple, Anum_ag_label_seq_name, tuple_desc, &is_null);
     Assert(!is_null);
-    namecpy(&cache_data->seq_name, DatumGetName(value));
+    namestrcpy(&cache_data->seq_name, DatumGetName(value)->data);
 }
diff --git a/src/backend/utils/graph_generation.c 
b/src/backend/utils/graph_generation.c
index 0d5d80aa..9b507e11 100644
--- a/src/backend/utils/graph_generation.c
+++ b/src/backend/utils/graph_generation.c
@@ -83,7 +83,7 @@ Datum create_complete_graph(PG_FUNCTION_ARGS)
     int64 no_vertices;
     int64 i,j,vid = 1, eid, start_vid, end_vid;
 
-    Name vtx_label_name = NULL;
+    Name vtx_label_name;
     Name edge_label_name;
     int32 vtx_label_id;
     int32 edge_label_id;
@@ -134,7 +134,6 @@ Datum create_complete_graph(PG_FUNCTION_ARGS)
     graph_name = PG_GETARG_NAME(0);
     no_vertices = (int64) PG_GETARG_INT64(1);
     edge_label_name = PG_GETARG_NAME(2);
-    namestrcpy(vtx_label_name, AG_DEFAULT_LABEL_VERTEX);
 
     graph_name_str = NameStr(*graph_name);
     vtx_name_str = AG_DEFAULT_LABEL_VERTEX;

Reply via email to