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/age.git
The following commit(s) were added to refs/heads/master by this push:
new 6059abec Update files causing warning messages in DockerHub builds
part 2 (#1097)
6059abec is described below
commit 6059abeca321498d33478dc10934d7f2e1971ba0
Author: John Gemignani <[email protected]>
AuthorDate: Tue Jul 25 15:49:55 2023 -0700
Update files causing warning messages in DockerHub builds part 2 (#1097)
Updated the following files which were generating warning
messages in the DockerHub builds -
modified: src/backend/parser/cypher_clause.c
modified: src/backend/utils/adt/agtype.c
---
src/backend/parser/cypher_clause.c | 7 +++++++
src/backend/utils/adt/agtype.c | 20 +++++++++++++++-----
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/src/backend/parser/cypher_clause.c
b/src/backend/parser/cypher_clause.c
index df1a4348..299f1203 100644
--- a/src/backend/parser/cypher_clause.c
+++ b/src/backend/parser/cypher_clause.c
@@ -1334,6 +1334,13 @@ static Query *transform_cypher_unwind(cypher_parsestate
*cpstate,
pnsi = transform_prev_cypher_clause(cpstate, clause->prev, true);
rtindex = list_length(pstate->p_rtable);
Assert(rtindex == 1); // rte is the first RangeTblEntry in pstate
+ if (rtindex != 1)
+ {
+ ereport(ERROR,
+ (errcode(ERRCODE_DATATYPE_MISMATCH),
+ errmsg("invalid value for rtindex")));
+ }
+
query->targetList = expandNSItemAttrs(pstate, pnsi, 0, -1);
}
diff --git a/src/backend/utils/adt/agtype.c b/src/backend/utils/adt/agtype.c
index f60f85ee..c9541922 100644
--- a/src/backend/utils/adt/agtype.c
+++ b/src/backend/utils/adt/agtype.c
@@ -5574,11 +5574,13 @@ Datum age_tointeger(PG_FUNCTION_ARGS)
result = agtv_value->val.int_value;
else if (agtv_value->type == AGTV_FLOAT)
{
- float f = agtv_value->val.float_value;
+ float8 f = agtv_value->val.float_value;
if (isnan(f) || isinf(f) ||
- f < PG_INT64_MIN || f > PG_INT64_MAX)
+ f < (float8)PG_INT64_MIN || f > (float8)PG_INT64_MAX)
+ {
PG_RETURN_NULL();
+ }
result = (int64) f;
}
@@ -5591,8 +5593,10 @@ Datum age_tointeger(PG_FUNCTION_ARGS)
numeric_float8_no_overflow, num));
if (isnan(f) || isinf(f) ||
- f < PG_INT64_MIN || f > PG_INT64_MAX)
+ f < (float8)PG_INT64_MIN || f > (float8)PG_INT64_MAX)
+ {
PG_RETURN_NULL();
+ }
result = (int64) f;
}
@@ -5609,7 +5613,7 @@ Datum age_tointeger(PG_FUNCTION_ARGS)
*/
if (!is_valid)
{
- float f;
+ float8 f;
f = float8in_internal_null(string, NULL, "double precision",
string, &is_valid);
@@ -5619,18 +5623,24 @@ Datum age_tointeger(PG_FUNCTION_ARGS)
* return null.
*/
if (!is_valid || isnan(f) || isinf(f) ||
- f < PG_INT64_MIN || f > PG_INT64_MAX)
+ f < (float8)PG_INT64_MIN || f > (float8)PG_INT64_MAX)
+ {
PG_RETURN_NULL();
+ }
result = (int64) f;
}
else
+ {
free(string);
+ }
}
else
+ {
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("toInteger() unsupported argument agtype
%d",
agtv_value->type)));
+ }
}
/* build the result */