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

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

commit e20ef7685f1c4e164b0f95c7f458beb588db2010
Author: John Gemignani <[email protected]>
AuthorDate: Mon Jul 3 17:42:39 2023 -0700

    Post merge corrections and modifications
    
    On branch master_PG12 modified the following files -
    
        modified:   src/backend/executor/cypher_set.c
        modified:   src/backend/parser/cypher_clause.c
        modified:   src/backend/utils/adt/agtype.c
        modified:   src/backend/utils/adt/graphid.c
        modified:   age--1.3.0.sql
        modified:   regress/expected/catalog.out
        modified:   regress/sql/catalog.sql
        modified:   src/backend/nodes/cypher_readfuncs.c
        modified:   src/include/nodes/cypher_nodes.h
        modified:   src/backend/catalog/ag_graph.c
        modified:   src/backend/executor/cypher_create.c
        modified:   src/backend/executor/cypher_merge.c
        modified:   src/backend/utils/adt/graphid.c
        modified:   src/backend/utils/graph_generation.c
    
    These files were modified from specifying PG12 to
    specifying the master. Mostly related to the CI flow -
    
        modified:   .github/workflows/installcheck.yaml
        modified:   META.json
        modified:   drivers/docker-compose.yml
        modified:   
drivers/jdbc/lib/src/test/java/org/apache/age/jdbc/BaseDockerizedTest.java
        renamed:    .github/workflows/installcheck.yml -> 
.github/workflows/installcheck.yaml
---
 .github/workflows/installcheck.yaml                |  32 +++----
 .github/workflows/installcheck.yml                 |  52 ----------
 META.json                                          |   8 +-
 age--1.3.0.sql                                     |   2 -
 drivers/docker-compose.yml                         |   2 +-
 .../org/apache/age/jdbc/BaseDockerizedTest.java    |   2 +-
 regress/expected/catalog.out                       |   8 +-
 regress/sql/catalog.sql                            |   2 +-
 src/backend/catalog/ag_graph.c                     |   4 +
 src/backend/executor/cypher_create.c               |   2 +-
 src/backend/executor/cypher_merge.c                |   2 +-
 src/backend/executor/cypher_set.c                  |   4 +-
 src/backend/nodes/cypher_readfuncs.c               |  14 +--
 src/backend/parser/cypher_clause.c                 |  10 +-
 src/backend/utils/adt/agtype.c                     | 106 ++++++++++-----------
 src/backend/utils/adt/graphid.c                    |   6 +-
 src/backend/utils/graph_generation.c               |   2 +-
 src/include/nodes/cypher_nodes.h                   |   6 +-
 18 files changed, 103 insertions(+), 161 deletions(-)

diff --git a/.github/workflows/installcheck.yaml 
b/.github/workflows/installcheck.yaml
index b18921f2..c35979cd 100644
--- a/.github/workflows/installcheck.yaml
+++ b/.github/workflows/installcheck.yaml
@@ -2,32 +2,32 @@ name: Build / Regression
 
 on:
   push:
-    branches: [ 'master', 'PG11' ]
+    branches: [ 'master', 'PG12' ]
   pull_request:
-    branches: [ 'master', 'PG11' ]
+    branches: [ 'master', 'PG12' ]
 
 jobs:
   build:
     runs-on: ubuntu-latest
 
     steps:
-      - name: Get latest commit id of PostgreSQL 11
+      - name: Get latest commit id of PostgreSQL 12
         run: |
-          echo "PG_COMMIT_HASH=$(git ls-remote 
git://git.postgresql.org/git/postgresql.git refs/heads/REL_11_STABLE | awk 
'{print $1}')" >> $GITHUB_ENV
+          echo "PG_COMMIT_HASH=$(git ls-remote 
git://git.postgresql.org/git/postgresql.git refs/heads/REL_12_STABLE | awk 
'{print $1}')" >> $GITHUB_ENV
 
-      - name: Cache PostgreSQL 11
+      - name: Cache PostgreSQL 12
         uses: actions/cache@v3
-        id: pg11cache
+        id: pg12cache
         with:
-          path: ~/pg11
-          key: ${{ runner.os }}-v1-pg11-${{ env.PG_COMMIT_HASH }}
+          path: ~/pg12
+          key: ${{ runner.os }}-v1-pg12-${{ env.PG_COMMIT_HASH }}
 
-      - name: Install PostgreSQL 11
-        if: steps.pg11cache.outputs.cache-hit != 'true'
+      - name: Install PostgreSQL 12
+        if: steps.pg12cache.outputs.cache-hit != 'true'
         run: |
-          git clone --depth 1 --branch REL_11_STABLE 
git://git.postgresql.org/git/postgresql.git ~/pg11source
-          cd ~/pg11source
-          ./configure --prefix=$HOME/pg11 CFLAGS="-std=gnu99 -ggdb -O0" 
--enable-cassert
+          git clone --depth 1 --branch REL_12_STABLE 
git://git.postgresql.org/git/postgresql.git ~/pg12source
+          cd ~/pg12source
+          ./configure --prefix=$HOME/pg12 CFLAGS="-std=gnu99 -ggdb -O0" 
--enable-cassert
           make install -j$(nproc) > /dev/null
 
       - uses: actions/checkout@v3
@@ -35,14 +35,14 @@ jobs:
       - name: Build
         id: build
         run: |
-          make PG_CONFIG=$HOME/pg11/bin/pg_config install -j$(nproc)
+          make PG_CONFIG=$HOME/pg12/bin/pg_config install -j$(nproc)
 
       - name: Regression tests
         id: regression_tests
         run: |
-          make PG_CONFIG=$HOME/pg11/bin/pg_config installcheck
+          make PG_CONFIG=$HOME/pg12/bin/pg_config installcheck
         continue-on-error: true
-          
+
       - name: Dump regression test errors
         if: steps.regression_tests.outcome != 'success'
         run: |
diff --git a/.github/workflows/installcheck.yml 
b/.github/workflows/installcheck.yml
deleted file mode 100644
index 8372203e..00000000
--- a/.github/workflows/installcheck.yml
+++ /dev/null
@@ -1,52 +0,0 @@
-name: PG12 Regression
-
-on:
-  push:
-    branches: [ 'PG12' ]
-  pull_request:
-    branches: [ 'PG12' ]
-
-jobs:
-  build:
-    runs-on: ubuntu-latest
-
-    steps:
-      - name: Get latest commit id of PostgreSQL 12
-        run: |
-          echo "PG_COMMIT_HASH=$(git ls-remote 
git://git.postgresql.org/git/postgresql.git refs/heads/REL_12_STABLE | awk 
'{print $1}')" >> $GITHUB_ENV
-
-      - name: Cache PostgreSQL 12
-        uses: actions/cache@v3
-        id: pg12cache
-        with:
-          path: ~/pg12
-          key: ${{ runner.os }}-v1-pg12-${{ env.PG_COMMIT_HASH }}
-
-      - name: Install PostgreSQL 12
-        if: steps.pg12cache.outputs.cache-hit != 'true'
-        run: |
-          git clone --depth 1 --branch REL_12_STABLE 
git://git.postgresql.org/git/postgresql.git ~/pg12source
-          cd ~/pg12source
-          ./configure --prefix=$HOME/pg12 CFLAGS="-std=gnu99 -ggdb -O0" 
--enable-cassert
-          make install -j$(nproc) > /dev/null
-
-      - uses: actions/checkout@v3
-
-      - name: Build
-        id: build
-        run: |
-          make PG_CONFIG=$HOME/pg12/bin/pg_config install -j$(nproc)
-
-      - name: Regression tests
-        id: regression_tests
-        run: |
-          make PG_CONFIG=$HOME/pg12/bin/pg_config installcheck
-        continue-on-error: true
-          
-      - name: Dump regression test errors
-        if: steps.regression_tests.outcome != 'success'
-        run: |
-          echo "Dump section begin."
-          cat $HOME/work/age/age/regress/regression.diffs
-          echo "Dump section end."
-          exit 1
diff --git a/META.json b/META.json
index e17fda2f..96f74022 100644
--- a/META.json
+++ b/META.json
@@ -2,7 +2,7 @@
    "name": "ApacheAGE",
    "abstract": "Apache AGE is a PostgreSQL Extension that provides graph 
database functionality",
    "description": "Apache AGE is a PostgreSQL Extension that provides graph 
database functionality. AGE is an acronym for A Graph Extension, and is 
inspired by Bitnine's fork of PostgreSQL 10, AgensGraph, which is a multi-model 
database. The goal of the project is to create single storage that can handle 
both relational and graph model data so that users can use standard ANSI SQL 
along with openCypher, the Graph query language. A graph consists of a set of 
vertices (also called nodes) an [...]
-   "version": "1.1.0",
+   "version": "1.3.0",
    "maintainer": [
       "[email protected]"
    ],
@@ -10,9 +10,9 @@
    "provides": {
       "ApacheAGE": {
          "abstract": "Apache AGE is a PostgreSQL Extension that provides graph 
database functionality",
-         "file": "age--1.1.0.sql",
+         "file": "age--1.3.0.sql",
          "docfile": "README.md",
-         "version": "1.1.0"
+         "version": "1.3.0"
       }
    },
    "prereqs": {
@@ -23,7 +23,7 @@
       }
    },
    "resources": {
-      "homepage": "https://github.com/apache/age/tree/AGE_PG12.1.0_ALPHA";,
+      "homepage": "https://github.com/apache/age/tree/master";,
       "bugtracker": {
          "web": "https://github.com/apache/age/issues";
       },
diff --git a/age--1.3.0.sql b/age--1.3.0.sql
index df636544..b364ad3e 100644
--- a/age--1.3.0.sql
+++ b/age--1.3.0.sql
@@ -24,7 +24,6 @@
 -- catalog tables
 --
 
-
 CREATE TABLE ag_graph (
   graphid oid NOT NULL,
   name name NOT NULL,
@@ -48,7 +47,6 @@ CREATE DOMAIN label_id AS int NOT NULL CHECK (VALUE > 0 AND 
VALUE <= 65535);
 CREATE DOMAIN label_kind AS "char" NOT NULL CHECK (VALUE = 'v' OR VALUE = 'e');
 
 CREATE TABLE ag_label (
-
   name name NOT NULL,
   graph oid NOT NULL,
   id label_id,
diff --git a/drivers/docker-compose.yml b/drivers/docker-compose.yml
index bd9bc06c..45ab86a3 100644
--- a/drivers/docker-compose.yml
+++ b/drivers/docker-compose.yml
@@ -1,7 +1,7 @@
 version: "3.3"
 services:
   db:
-    image: apache/age:PG12_latest
+    image: apache/age:${TAG}
     environment:
       - POSTGRES_USER=postgres
       - POSTGRES_PASSWORD=agens
diff --git 
a/drivers/jdbc/lib/src/test/java/org/apache/age/jdbc/BaseDockerizedTest.java 
b/drivers/jdbc/lib/src/test/java/org/apache/age/jdbc/BaseDockerizedTest.java
index b743258b..2ed48a73 100644
--- a/drivers/jdbc/lib/src/test/java/org/apache/age/jdbc/BaseDockerizedTest.java
+++ b/drivers/jdbc/lib/src/test/java/org/apache/age/jdbc/BaseDockerizedTest.java
@@ -56,7 +56,7 @@ public class BaseDockerizedTest {
             imageTag = "latest";
         }
         agensGraphContainer = new GenericContainer<>(DockerImageName
-            .parse("apache/age:PG12_latest"))
+            .parse("apache/age:" + imageTag))
             .withEnv("POSTGRES_PASSWORD", CORRECT_DB_PASSWORDS)
             .withExposedPorts(5432);
         agensGraphContainer.start();
diff --git a/regress/expected/catalog.out b/regress/expected/catalog.out
index 44ff2959..bc7b9434 100644
--- a/regress/expected/catalog.out
+++ b/regress/expected/catalog.out
@@ -28,10 +28,10 @@ NOTICE:  graph "graph" has been created
  
 (1 row)
 
-SELECT * FROM ag_graph WHERE name = 'graph';
- graphid | name  | namespace 
----------+-------+-----------
-   17639 | graph | graph
+SELECT name, namespace FROM ag_graph WHERE name = 'graph';
+ name  | namespace 
+-------+-----------
+ graph | graph
 (1 row)
 
 -- create a label to test drop_label()
diff --git a/regress/sql/catalog.sql b/regress/sql/catalog.sql
index 5ae04fcc..96c63e47 100644
--- a/regress/sql/catalog.sql
+++ b/regress/sql/catalog.sql
@@ -25,7 +25,7 @@ SET search_path TO ag_catalog;
 --
 
 SELECT create_graph('graph');
-SELECT * FROM ag_graph WHERE name = 'graph';
+SELECT name, namespace FROM ag_graph WHERE name = 'graph';
 
 -- create a label to test drop_label()
 SELECT * FROM cypher('graph', $$CREATE (:l)$$) AS r(a agtype);
diff --git a/src/backend/catalog/ag_graph.c b/src/backend/catalog/ag_graph.c
index a344a6a3..f4a0d721 100644
--- a/src/backend/catalog/ag_graph.c
+++ b/src/backend/catalog/ag_graph.c
@@ -157,9 +157,13 @@ Oid get_graph_oid(const char *graph_name)
 
     cache_data = search_graph_name_cache(graph_name);
     if (cache_data)
+    {
         return cache_data->oid;
+    }
     else
+    {
         return InvalidOid;
+    }
 }
 
 static Oid get_graph_namespace(const char *graph_name)
diff --git a/src/backend/executor/cypher_create.c 
b/src/backend/executor/cypher_create.c
index d7547520..4b481092 100644
--- a/src/backend/executor/cypher_create.c
+++ b/src/backend/executor/cypher_create.c
@@ -106,7 +106,7 @@ static void begin_cypher_create(CustomScanState *node, 
EState *estate,
             if (!CYPHER_TARGET_NODE_INSERT_ENTITY(cypher_node->flags))
                 continue;
 
-            // Open relation and aquire a row exclusive lock.
+            // Open relation and acquire a row exclusive lock.
             rel = table_open(cypher_node->relid, RowExclusiveLock);
 
             // Initialize resultRelInfo for the vertex
diff --git a/src/backend/executor/cypher_merge.c 
b/src/backend/executor/cypher_merge.c
index 845c0878..c386e652 100644
--- a/src/backend/executor/cypher_merge.c
+++ b/src/backend/executor/cypher_merge.c
@@ -117,7 +117,7 @@ static void begin_cypher_merge(CustomScanState *node, 
EState *estate,
             continue;
         }
 
-        // Open relation and aquire a row exclusive lock.
+        // Open relation and acquire a row exclusive lock.
         rel = table_open(cypher_node->relid, RowExclusiveLock);
 
         // Initialize resultRelInfo for the vertex
diff --git a/src/backend/executor/cypher_set.c 
b/src/backend/executor/cypher_set.c
index 29c5fad2..7a8ec9b3 100644
--- a/src/backend/executor/cypher_set.c
+++ b/src/backend/executor/cypher_set.c
@@ -139,9 +139,7 @@ static HeapTuple update_entity_tuple(ResultRelInfo 
*resultRelInfo,
 
         result = table_tuple_update(resultRelInfo->ri_RelationDesc,
                                     &tuple->t_self, elemTupleSlot,
-                                    cid,
-                                    //estate->es_output_cid,
-                                    estate->es_snapshot,// NULL,
+                                    cid, estate->es_snapshot,
                                     estate->es_crosscheck_snapshot,
                                     true /* wait for commit */ ,
                                     &hufd, &lockmode, &update_indexes);
diff --git a/src/backend/nodes/cypher_readfuncs.c 
b/src/backend/nodes/cypher_readfuncs.c
index 45ecc306..89cedd57 100644
--- a/src/backend/nodes/cypher_readfuncs.c
+++ b/src/backend/nodes/cypher_readfuncs.c
@@ -186,8 +186,8 @@ void read_cypher_create_target_nodes(struct ExtensibleNode 
*node)
     READ_LOCALS(cypher_create_target_nodes);
 
     READ_NODE_FIELD(paths);
-    READ_INT_FIELD(flags);
-    READ_INT_FIELD(graph_oid);
+    READ_UINT_FIELD(flags);
+    READ_UINT_FIELD(graph_oid);
 }
 
 /*
@@ -212,7 +212,7 @@ void read_cypher_target_node(struct ExtensibleNode *node)
     READ_LOCALS(cypher_target_node);
 
     READ_CHAR_FIELD(type);
-    READ_INT_FIELD(flags);
+    READ_UINT_FIELD(flags);
     READ_ENUM_FIELD(dir, cypher_rel_dir);
     READ_NODE_FIELD(id_expr);
     READ_NODE_FIELD(id_expr_state);
@@ -236,7 +236,7 @@ void read_cypher_update_information(struct ExtensibleNode 
*node)
     READ_LOCALS(cypher_update_information);
 
     READ_NODE_FIELD(set_items);
-    READ_INT_FIELD(flags);
+    READ_UINT_FIELD(flags);
     READ_INT_FIELD(tuple_position);
     READ_STRING_FIELD(graph_name);
     READ_STRING_FIELD(clause_name);
@@ -268,9 +268,9 @@ void read_cypher_delete_information(struct ExtensibleNode 
*node)
     READ_LOCALS(cypher_delete_information);
 
     READ_NODE_FIELD(delete_items);
-    READ_INT_FIELD(flags);
+    READ_UINT_FIELD(flags);
     READ_STRING_FIELD(graph_name);
-    READ_INT_FIELD(graph_oid);
+    READ_UINT_FIELD(graph_oid);
     READ_BOOL_FIELD(detach);
 }
 
@@ -294,7 +294,7 @@ void read_cypher_merge_information(struct ExtensibleNode 
*node)
 {
     READ_LOCALS(cypher_merge_information);
 
-    READ_INT_FIELD(flags);
+    READ_UINT_FIELD(flags);
     READ_UINT_FIELD(graph_oid);
     READ_INT_FIELD(merge_function_attr);
     READ_NODE_FIELD(path);
diff --git a/src/backend/parser/cypher_clause.c 
b/src/backend/parser/cypher_clause.c
index 2fe8ee23..f14c4998 100644
--- a/src/backend/parser/cypher_clause.c
+++ b/src/backend/parser/cypher_clause.c
@@ -279,15 +279,9 @@ static cypher_target_node 
*get_referenced_variable(ParseState *pstate,
 
 //call...[yield]
 static Query *transform_cypher_call_stmt(cypher_parsestate *cpstate,
-                                      cypher_clause *clause);
+                                         cypher_clause *clause);
 static Query *transform_cypher_call_subquery(cypher_parsestate *cpstate,
-                                          cypher_clause *clause);
-
-//call...[yield]
-static Query *transform_cypher_call_stmt(cypher_parsestate *cpstate,
-                                      cypher_clause *clause);
-static Query *transform_cypher_call_subquery(cypher_parsestate *cpstate,
-                                          cypher_clause *clause);
+                                             cypher_clause *clause);
 
 // transform
 #define PREV_CYPHER_CLAUSE_ALIAS 
AGE_DEFAULT_ALIAS_PREFIX"previous_cypher_clause"
diff --git a/src/backend/utils/adt/agtype.c b/src/backend/utils/adt/agtype.c
index fa75171a..43c1b205 100644
--- a/src/backend/utils/adt/agtype.c
+++ b/src/backend/utils/adt/agtype.c
@@ -159,25 +159,25 @@ static bool is_array_path(agtype_value *agtv);
 /* graph entity retrieval */
 static Datum get_vertex(const char *graph, const char *vertex_label,
                         int64 graphid);
-static char *get_label_name(const char *graph_name, int64 label_id);
+static char *get_label_name(const char *graph_name, graphid element_graphid);
 static float8 get_float_compatible_arg(Datum arg, Oid type, char *funcname,
                                        bool *is_null);
 static Numeric get_numeric_compatible_arg(Datum arg, Oid type, char *funcname,
-                                       bool *is_null,
-                                       enum agtype_value_type *ag_type);
+                                          bool *is_null,
+                                          enum agtype_value_type *ag_type);
 agtype *get_one_agtype_from_variadic_args(FunctionCallInfo fcinfo,
-                                                 int variadic_offset,
-                                                 int expected_nargs);
+                                          int variadic_offset,
+                                          int expected_nargs);
 
 static int64 get_int64_from_int_datums(Datum d, Oid type, char *funcname,
                                        bool *is_agnull);
 
 static agtype_iterator *get_next_object_key(agtype_iterator *it,
-                                             agtype_container *agtc,
-                                             agtype_value *key);
+                                            agtype_container *agtc,
+                                            agtype_value *key);
 static agtype_iterator *get_next_list_element(agtype_iterator *it,
-                                             agtype_container *agtc,
-                                             agtype_value *elem);
+                                              agtype_container *agtc,
+                                              agtype_value *elem);
 static int extract_variadic_args_min(FunctionCallInfo fcinfo,
                                      int variadic_start, bool convert_unknown,
                                      Datum **args, Oid **types, bool **nulls,
@@ -195,8 +195,8 @@ Oid get_AGTYPEOID(void)
     if (g_AGTYPEOID == InvalidOid)
     {
         g_AGTYPEOID = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid,
-                                    CStringGetDatum("agtype"),
-                                    
ObjectIdGetDatum(ag_catalog_namespace_id()));
+                                      CStringGetDatum("agtype"),
+                                      
ObjectIdGetDatum(ag_catalog_namespace_id()));
     }
 
     return g_AGTYPEOID;
@@ -2642,7 +2642,7 @@ Datum agtype_to_int8(PG_FUNCTION_ARGS)
         result = DatumGetInt64(DirectFunctionCall1(int8in,
                            CStringGetDatum(agtv.val.string.val)));
     else if(agtv.type == AGTV_BOOL)
-        result = DatumGetInt64(DirectFunctionCall1(bool_int4, 
+        result = DatumGetInt64(DirectFunctionCall1(bool_int4,
                       BoolGetDatum(agtv.val.boolean)));
     else
         elog(ERROR, "invalid agtype type: %d", (int)agtv.type);
@@ -2667,7 +2667,7 @@ Datum agtype_to_int4(PG_FUNCTION_ARGS)
 
     /* Return null if arg_agt is null. This covers SQL and Agtype NULLS */
     if (arg_agt == NULL)
-    {    
+    {
         PG_RETURN_NULL();
     }
 
@@ -2677,39 +2677,39 @@ Datum agtype_to_int4(PG_FUNCTION_ARGS)
          agtv.type != AGTV_NUMERIC &&
          agtv.type != AGTV_STRING &&
          agtv.type != AGTV_BOOL))
-    {    
+    {
         cannot_cast_agtype_value(agtv.type, "int");
     }
 
     PG_FREE_IF_COPY(agtype_in, 0);
 
     if (agtv.type == AGTV_INTEGER)
-    {    
+    {
         result = DatumGetInt32(DirectFunctionCall1(int84,
                     Int64GetDatum(agtv.val.int_value)));
     }
     else if (agtv.type == AGTV_FLOAT)
-    {    
+    {
         result = DatumGetInt32(DirectFunctionCall1(dtoi4,
                                 Float8GetDatum(agtv.val.float_value)));
     }
     else if (agtv.type == AGTV_NUMERIC)
-    {    
+    {
         result = DatumGetInt32(DirectFunctionCall1(numeric_int4,
                      NumericGetDatum(agtv.val.numeric)));
     }
     else if (agtv.type == AGTV_STRING)
-    {    
+    {
         result = DatumGetInt32(DirectFunctionCall1(int4in,
                            CStringGetDatum(agtv.val.string.val)));
     }
     else if (agtv.type == AGTV_BOOL)
-    {    
-        result = DatumGetInt64(DirectFunctionCall1(bool_int4, 
+    {
+        result = DatumGetInt64(DirectFunctionCall1(bool_int4,
                     BoolGetDatum(agtv.val.boolean)));
     }
     else
-    {    
+    {
         elog(ERROR, "invalid agtype type: %d", (int)agtv.type);
     }
 
@@ -2781,7 +2781,7 @@ Datum agtype_to_float8(PG_FUNCTION_ARGS)
     {
         cannot_cast_agtype_value(agtv.type, "float");
     }
-    
+
     PG_FREE_IF_COPY(agtype_in, 0);
 
     if (agtv.type == AGTV_FLOAT)
@@ -2808,7 +2808,7 @@ Datum agtype_to_float8(PG_FUNCTION_ARGS)
                             errmsg("cannot cast to float8, integer value out 
of range")));
     }
     else if (agtv.type == AGTV_NUMERIC)
-    {    
+    {
         result = DatumGetFloat8(DirectFunctionCall1(numeric_float8,
                      NumericGetDatum(agtv.val.numeric)));
     }
@@ -2818,10 +2818,10 @@ Datum agtype_to_float8(PG_FUNCTION_ARGS)
                                                     
CStringGetDatum(agtv.val.string.val)));
     }
     else
-    {    
+    {
         elog(ERROR, "invalid agtype type: %d", (int)agtv.type);
     }
-    
+
     PG_RETURN_FLOAT8(result);
 }
 
@@ -4056,13 +4056,13 @@ Datum agtype_typecast_int(PG_FUNCTION_ARGS)
 
     /* Return null if arg_agt is null. This covers SQL and Agtype NULLS */
     if (arg_agt == NULL)
-    {    
+    {
         PG_RETURN_NULL();
     }
 
     /* check that we have a scalar value */
     if (!AGT_ROOT_IS_SCALAR(arg_agt))
-    {    
+    {
         ereport(ERROR,
                 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                  errmsg("typecast argument must be a scalar value")));
@@ -4073,7 +4073,7 @@ Datum agtype_typecast_int(PG_FUNCTION_ARGS)
 
     /* check for agtype null */
     if (arg_value->type == AGTV_NULL)
-    {    
+    {
         PG_RETURN_NULL();
     }
 
@@ -4092,7 +4092,7 @@ Datum agtype_typecast_int(PG_FUNCTION_ARGS)
                                 NumericGetDatum(arg_value->val.numeric));
         break;
     case AGTV_BOOL:
-        d = DirectFunctionCall1(bool_int4, 
+        d = DirectFunctionCall1(bool_int4,
                                 BoolGetDatum(arg_value->val.boolean));
         break;
     case AGTV_STRING:
@@ -4138,13 +4138,13 @@ Datum agtype_typecast_bool(PG_FUNCTION_ARGS)
 
     /* Return null if arg_agt is null. This covers SQL and Agtype NULLS */
     if (arg_agt == NULL)
-    {    
+    {
         PG_RETURN_NULL();
     }
 
     /* check that we have a scalar value */
     if (!AGT_ROOT_IS_SCALAR(arg_agt))
-    {    
+    {
         ereport(ERROR,
                 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                  errmsg("typecast argument must be a scalar value")));
@@ -4155,7 +4155,7 @@ Datum agtype_typecast_bool(PG_FUNCTION_ARGS)
 
     /* check for agtype null */
     if (arg_value->type == AGTV_NULL)
-    {    
+    {
         PG_RETURN_NULL();
     }
 
@@ -4666,11 +4666,11 @@ Datum column_get_datum(TupleDesc tupdesc, HeapTuple 
tuple, int column,
 }
 
 /*
- * Function to retrieve a label name, given the graph name and graphid. The
- * function returns a pointer to a duplicated string that needs to be freed
- * when you are finished using it.
+ * Function to retrieve a label name, given the graph name and graphid of the
+ * node or edge. The function returns a pointer to a duplicated string that
+ * needs to be freed when you are finished using it.
  */
-static char *get_label_name(const char *graph_name, int64 label_id)
+static char *get_label_name(const char *graph_name, graphid element_graphid)
 {
     ScanKeyData scan_keys[2];
     Relation ag_label;
@@ -4678,16 +4678,16 @@ static char *get_label_name(const char *graph_name, 
int64 label_id)
     HeapTuple tuple;
     TupleDesc tupdesc;
     char *result = NULL;
-    bool column_is_null;
-
-    Oid graph_id = get_graph_oid(graph_name);
+    bool column_is_null = false;
+    Oid graph_oid = get_graph_oid(graph_name);
+    int32 label_id = get_graphid_label_id(element_graphid);
 
     /* scankey for first match in ag_label, column 2, graphoid, BTEQ, OidEQ */
     ScanKeyInit(&scan_keys[0], Anum_ag_label_graph, BTEqualStrategyNumber,
-                F_OIDEQ, ObjectIdGetDatum(graph_id));
+                F_OIDEQ, ObjectIdGetDatum(graph_oid));
     /* scankey for second match in ag_label, column 3, label id, BTEQ, Int4EQ 
*/
     ScanKeyInit(&scan_keys[1], Anum_ag_label_id, BTEqualStrategyNumber,
-                F_INT42EQ, Int32GetDatum(get_graphid_label_id(label_id)));
+                F_INT4EQ, Int32GetDatum(label_id));
 
     ag_label = table_open(ag_label_relation_id(), ShareLock);
     scan_desc = systable_beginscan(ag_label, ag_label_graph_oid_index_id(), 
true,
@@ -4698,7 +4698,7 @@ static char *get_label_name(const char *graph_name, int64 
label_id)
     {
         ereport(ERROR,
                 (errcode(ERRCODE_UNDEFINED_SCHEMA),
-                 errmsg("graphid abc %lu does not exist", label_id)));
+                 errmsg("graphid %lu does not exist", element_graphid)));
     }
 
     /* get the tupdesc - we don't need to release this one */
@@ -4713,8 +4713,8 @@ static char *get_label_name(const char *graph_name, int64 
label_id)
     }
 
     /* get the label name */
-    result = NameStr(*DatumGetName(
-        heap_getattr(tuple, Anum_ag_label_name, tupdesc, &column_is_null)));
+    result = NameStr(*DatumGetName(heap_getattr(tuple, Anum_ag_label_name,
+                                                tupdesc, &column_is_null)));
     /* duplicate it */
     result = strdup(result);
 
@@ -4757,7 +4757,7 @@ static Datum get_vertex(const char *graph, const char 
*vertex_label,
     {
         ereport(ERROR,
                 (errcode(ERRCODE_UNDEFINED_TABLE),
-                 errmsg("graphid cde %lu does not exist", graphid)));
+                 errmsg("graphid %lu does not exist", graphid)));
     }
 
     /* get the tupdesc - we don't need to release this one */
@@ -4793,7 +4793,7 @@ Datum age_startnode(PG_FUNCTION_ARGS)
     agtype_value *agtv_value = NULL;
     char *graph_name = NULL;
     char *label_name = NULL;
-    graphid graph_oid;
+    graphid start_id;
     Datum result;
 
     /* we need the graph name */
@@ -4835,14 +4835,14 @@ Datum age_startnode(PG_FUNCTION_ARGS)
     /* it must not be null and must be an integer */
     Assert(agtv_value != NULL);
     Assert(agtv_value->type = AGTV_INTEGER);
-    graph_oid = agtv_value->val.int_value;
+    start_id = agtv_value->val.int_value;
 
     /* get the label */
-    label_name = get_label_name(graph_name, graph_oid);
+    label_name = get_label_name(graph_name, start_id);
     /* it must not be null and must be a string */
     Assert(label_name != NULL);
 
-    result = get_vertex(graph_name, label_name, graph_oid);
+    result = get_vertex(graph_name, label_name, start_id);
 
     free(label_name);
 
@@ -4858,7 +4858,7 @@ Datum age_endnode(PG_FUNCTION_ARGS)
     agtype_value *agtv_value = NULL;
     char *graph_name = NULL;
     char *label_name = NULL;
-    graphid graph_oid;
+    graphid end_id;
     Datum result;
 
     /* we need the graph name */
@@ -4900,14 +4900,14 @@ Datum age_endnode(PG_FUNCTION_ARGS)
     /* it must not be null and must be an integer */
     Assert(agtv_value != NULL);
     Assert(agtv_value->type = AGTV_INTEGER);
-    graph_oid = agtv_value->val.int_value;
+    end_id = agtv_value->val.int_value;
 
     /* get the label */
-    label_name = get_label_name(graph_name, graph_oid);
+    label_name = get_label_name(graph_name, end_id);
     /* it must not be null and must be a string */
     Assert(label_name != NULL);
 
-    result = get_vertex(graph_name, label_name, graph_oid);
+    result = get_vertex(graph_name, label_name, end_id);
 
     free(label_name);
 
diff --git a/src/backend/utils/adt/graphid.c b/src/backend/utils/adt/graphid.c
index 89bd8e52..2060fc66 100644
--- a/src/backend/utils/adt/graphid.c
+++ b/src/backend/utils/adt/graphid.c
@@ -36,9 +36,9 @@ Oid get_GRAPHIDOID(void)
 {
     if (g_GRAPHIDOID == InvalidOid)
     {
-      g_GRAPHIDOID = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid,
-                                         CStringGetDatum("graphid"),
-                                         
ObjectIdGetDatum(ag_catalog_namespace_id()));
+        g_GRAPHIDOID = GetSysCacheOid2(TYPENAMENSP, Anum_pg_type_oid,
+                                       CStringGetDatum("graphid"),
+                                       
ObjectIdGetDatum(ag_catalog_namespace_id()));
     }
 
     return g_GRAPHIDOID;
diff --git a/src/backend/utils/graph_generation.c 
b/src/backend/utils/graph_generation.c
index cc67ccba..d8ce7904 100644
--- a/src/backend/utils/graph_generation.c
+++ b/src/backend/utils/graph_generation.c
@@ -240,7 +240,7 @@ PG_FUNCTION_INFO_V1(age_create_barbell_graph);
  *                                     n int,
  *                                     vertex_label_name Name DEFAULT = NULL,
  *                                     vertex_properties agtype DEFAULT = NULL,
- *                                     edge_label_name Name DEAULT = NULL,
+ *                                     edge_label_name Name DEFAULT = NULL,
  *                                     edge_properties agtype DEFAULT = NULL)
  * Input:
  *
diff --git a/src/include/nodes/cypher_nodes.h b/src/include/nodes/cypher_nodes.h
index b017f307..64318eb5 100644
--- a/src/include/nodes/cypher_nodes.h
+++ b/src/include/nodes/cypher_nodes.h
@@ -362,7 +362,7 @@ typedef struct cypher_update_information
 {
     ExtensibleNode extensible;
     List *set_items;
-    int flags;
+    uint32 flags;
     AttrNumber tuple_position;
     char *graph_name;
     char *clause_name;
@@ -384,7 +384,7 @@ typedef struct cypher_delete_information
 {
     ExtensibleNode extensible;
     List *delete_items;
-    int flags;
+    uint32 flags;
     char *graph_name;
     uint32 graph_oid;
     bool detach;
@@ -400,7 +400,7 @@ typedef struct cypher_delete_item
 typedef struct cypher_merge_information
 {
     ExtensibleNode extensible;
-    int flags;
+    uint32 flags;
     uint32 graph_oid;
     AttrNumber merge_function_attr;
     cypher_create_path *path;

Reply via email to