You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@age.apache.org by jo...@apache.org on 2021/10/01 20:16:33 UTC

[incubator-age] branch master updated: For primitive types like int, abandon using add_agtype. Instead push the value directly. (#124)

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

joshinnis 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 4dad234  For primitive types like int, abandon using add_agtype. Instead push the value directly. (#124)
4dad234 is described below

commit 4dad2346407de702e5ed00247b16e94254239785
Author: Quoc Viet Vuong <qu...@gmail.com>
AuthorDate: Sat Oct 2 03:16:25 2021 +0700

    For primitive types like int, abandon using add_agtype. Instead push the value directly. (#124)
---
 src/backend/utils/adt/agtype.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/backend/utils/adt/agtype.c b/src/backend/utils/adt/agtype.c
index 947dc01..d782d53 100644
--- a/src/backend/utils/adt/agtype.c
+++ b/src/backend/utils/adt/agtype.c
@@ -1815,7 +1815,8 @@ Datum _agtype_build_vertex(PG_FUNCTION_ARGS)
                  errmsg("_agtype_build_vertex() graphid cannot be NULL")));
 
     id = AG_GETARG_GRAPHID(0);
-    add_agtype(id, false, &result, GRAPHIDOID, false);
+    result.res = push_agtype_value(&result.parse_state, WAGT_VALUE,
+                                   integer_to_agtype_value(id));
 
     /* process label */
     result.res = push_agtype_value(&result.parse_state, WAGT_KEY,
@@ -1896,7 +1897,8 @@ Datum _agtype_build_edge(PG_FUNCTION_ARGS)
                  errmsg("_agtype_build_edge() graphid cannot be NULL")));
 
     id = AG_GETARG_GRAPHID(0);
-    add_agtype(id, false, &result, GRAPHIDOID, false);
+    result.res = push_agtype_value(&result.parse_state, WAGT_VALUE,
+                                   integer_to_agtype_value(id));
 
     /* process label */
     result.res = push_agtype_value(&result.parse_state, WAGT_KEY,
@@ -1920,7 +1922,8 @@ Datum _agtype_build_edge(PG_FUNCTION_ARGS)
                  errmsg("_agtype_build_edge() endid cannot be NULL")));
 
     end_id = AG_GETARG_GRAPHID(2);
-    add_agtype(end_id, false, &result, GRAPHIDOID, false);
+    result.res = push_agtype_value(&result.parse_state, WAGT_VALUE,
+                                   integer_to_agtype_value(end_id));
 
     /* process start_id */
     result.res = push_agtype_value(&result.parse_state, WAGT_KEY,
@@ -1932,7 +1935,8 @@ Datum _agtype_build_edge(PG_FUNCTION_ARGS)
                  errmsg("_agtype_build_edge() startid cannot be NULL")));
 
     start_id = AG_GETARG_GRAPHID(1);
-    add_agtype(start_id, false, &result, GRAPHIDOID, false);
+    result.res = push_agtype_value(&result.parse_state, WAGT_VALUE,
+                                   integer_to_agtype_value(start_id));
 
     /* process properties */
     result.res = push_agtype_value(&result.parse_state, WAGT_KEY,