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 2022/01/11 20:26:55 UTC
[incubator-age] branch master updated: Fix is_array_path to accept a single vertex.
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 a7a651b Fix is_array_path to accept a single vertex.
a7a651b is described below
commit a7a651ba752a33d702802455715000ebb99ae422
Author: John Gemignani <jr...@gmail.com>
AuthorDate: Mon Jan 10 16:30:41 2022 -0800
Fix is_array_path to accept a single vertex.
Fixed the is_array_path function to accept a single vertex.
---
src/backend/utils/adt/agtype.c | 21 +++++++--------------
src/backend/utils/adt/agtype_vle.c | 5 ++---
2 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/src/backend/utils/adt/agtype.c b/src/backend/utils/adt/agtype.c
index 2a78f96..094c935 100644
--- a/src/backend/utils/adt/agtype.c
+++ b/src/backend/utils/adt/agtype.c
@@ -317,7 +317,6 @@ static inline Datum agtype_from_cstring(char *str, int len)
/* callback for annotation (typecasts) */
sem.agtype_annotation = agtype_in_agtype_annotation;
-
parse_agtype(lex, &sem);
/* after parsing, the item member has the composed agtype structure */
@@ -328,13 +327,11 @@ size_t check_string_length(size_t len)
{
if (len > AGTENTRY_OFFLENMASK)
{
- ereport(
- ERROR,
- (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("string too long to represent as agtype string"),
- errdetail(
- "Due to an implementation restriction, agtype strings cannot exceed %d bytes.",
- AGTENTRY_OFFLENMASK)));
+ ereport(ERROR,
+ (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
+ errmsg("string too long to represent as agtype string"),
+ errdetail("Due to an implementation restriction, agtype strings cannot exceed %d bytes.",
+ AGTENTRY_OFFLENMASK)));
}
return len;
@@ -665,8 +662,8 @@ static bool is_array_path(agtype_value *agtv)
Assert(agtv != NULL);
Assert(agtv->type == AGTV_ARRAY);
- /* the array needs to have an odd number of elements greater than 2 */
- if (agtv->val.array.num_elems < 3 ||
+ /* the array needs to have an odd number of elements */
+ if (agtv->val.array.num_elems < 1 ||
(agtv->val.array.num_elems - 1) % 2 != 0)
return false;
@@ -1765,7 +1762,6 @@ agtype_value *integer_to_agtype_value(int64 int_value)
return agtv;
}
-
PG_FUNCTION_INFO_V1(_agtype_build_path);
/*
@@ -3206,7 +3202,6 @@ Datum agtype_btree_cmp(PG_FUNCTION_ARGS)
&agtype_rhs->root));
}
-
PG_FUNCTION_INFO_V1(agtype_typecast_numeric);
/*
* Execute function to typecast an agtype to an agtype numeric
@@ -3354,7 +3349,6 @@ Datum agtype_typecast_int(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(agtype_value_to_agtype(&result_value));
}
-
PG_FUNCTION_INFO_V1(agtype_typecast_float);
/*
* Execute function to typecast an agtype to an agtype float
@@ -3723,7 +3717,6 @@ Datum _property_constraint_check(PG_FUNCTION_ARGS)
PG_RETURN_BOOL(agtype_deep_contains(&property_it, &constraint_it));
}
-
PG_FUNCTION_INFO_V1(age_id);
Datum age_id(PG_FUNCTION_ARGS)
diff --git a/src/backend/utils/adt/agtype_vle.c b/src/backend/utils/adt/agtype_vle.c
index 2da3bd1..1f17f1a 100644
--- a/src/backend/utils/adt/agtype_vle.c
+++ b/src/backend/utils/adt/agtype_vle.c
@@ -2961,10 +2961,9 @@ Datum age_match_vle_terminal_edge(PG_FUNCTION_ARGS)
(has_veid ? veid == gida[gidasize - 1] : true));
}
+/* PG helper function to build an agtype (Datum) edge for matching */
PG_FUNCTION_INFO_V1(age_build_vle_match_edge);
-/*
- * PG helper function to build an agtype (Datum) edge for matching.
- */
+
Datum age_build_vle_match_edge(PG_FUNCTION_ARGS)
{
agtype_in_state result;