jrgemignani commented on code in PR #1013:
URL: https://github.com/apache/age/pull/1013#discussion_r1355739609
##########
src/backend/utils/adt/agtype.c:
##########
@@ -4972,6 +4972,54 @@ Datum age_last(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(agtype_value_to_agtype(agtv_result));
}
+PG_FUNCTION_INFO_V1(age_tail);
+/*
+ * Returns a list containing all the elements, excluding the first one, from
a list.
+ */
+Datum age_tail(PG_FUNCTION_ARGS)
+{
+ agtype *agt_arg = NULL;
+ agtype_in_state agis_result;
+ int count;
+ int i;
+
+ /* check for null */
+ if (PG_ARGISNULL(0))
+ PG_RETURN_NULL();
Review Comment:
Wrapping {}
##########
src/backend/utils/adt/agtype.c:
##########
@@ -4972,6 +4972,54 @@ Datum age_last(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(agtype_value_to_agtype(agtv_result));
}
+PG_FUNCTION_INFO_V1(age_tail);
+/*
+ * Returns a list containing all the elements, excluding the first one, from
a list.
+ */
+Datum age_tail(PG_FUNCTION_ARGS)
+{
+ agtype *agt_arg = NULL;
+ agtype_in_state agis_result;
+ int count;
+ int i;
+
+ /* check for null */
+ if (PG_ARGISNULL(0))
+ PG_RETURN_NULL();
+
+ agt_arg = AG_GET_ARG_AGTYPE_P(0);
+ /* check for an array */
+ if (!AGT_ROOT_IS_ARRAY(agt_arg) || AGT_ROOT_IS_SCALAR(agt_arg))
+ ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("tail() argument must resolve to a list or
null")));
+
+ count = AGT_ROOT_COUNT(agt_arg);
+
+ /* if we have an empty list or only one element in the list, return null */
+ if (count <= 1)
Review Comment:
Wrapping {}
##########
src/backend/utils/adt/agtype.c:
##########
@@ -4972,6 +4972,54 @@ Datum age_last(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(agtype_value_to_agtype(agtv_result));
}
+PG_FUNCTION_INFO_V1(age_tail);
+/*
+ * Returns a list containing all the elements, excluding the first one, from
a list.
+ */
+Datum age_tail(PG_FUNCTION_ARGS)
+{
+ agtype *agt_arg = NULL;
+ agtype_in_state agis_result;
+ int count;
+ int i;
+
+ /* check for null */
+ if (PG_ARGISNULL(0))
+ PG_RETURN_NULL();
+
+ agt_arg = AG_GET_ARG_AGTYPE_P(0);
+ /* check for an array */
+ if (!AGT_ROOT_IS_ARRAY(agt_arg) || AGT_ROOT_IS_SCALAR(agt_arg))
Review Comment:
Wrapping {}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]