From f20531243078022770b6c7ffdf897bac5148121c Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Fri, 30 Dec 2022 17:55:02 -0800 Subject: [PATCH] Added float_overflow_error function for Postgres 11 --- src/vector.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/vector.c b/src/vector.c index 5c118db..d232a23 100644 --- a/src/vector.c +++ b/src/vector.c @@ -9,12 +9,12 @@ #include "libpq/pqformat.h" #include "utils/array.h" #include "utils/builtins.h" -#include "utils/float.h" #include "utils/lsyscache.h" #include "utils/numeric.h" #if PG_VERSION_NUM >= 120000 #include "common/shortest_dec.h" +#include "utils/float.h" #else #include #endif @@ -100,6 +100,16 @@ CheckStateArray(ArrayType *statearray, const char *caller) return (float8 *) ARR_DATA_PTR(statearray); } +#if PG_VERSION_NUM < 120000 +static pg_noinline void +float_overflow_error(void) +{ + ereport(ERROR, + (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), + errmsg("value out of range: overflow"))); +} +#endif + /* * Print vector - useful for debugging */