28#include "utils/fmgrprotos.h"
46#error -ffast-math is known to break this code
107 errmsg(
"value out of range: overflow")));
115 errmsg(
"value out of range: underflow")));
123 errmsg(
"division by zero")));
131 errmsg(
"value out of range: overflow"));
139 errmsg(
"value out of range: underflow"));
147 errmsg(
"division by zero")));
226 struct Node *escontext)
238 while (*num !=
'\0' &&
isspace((
unsigned char) *num))
248 errmsg(
"invalid input syntax for type %s: \"%s\"",
255 if (endptr == num ||
errno != 0)
328 errmsg(
"\"%s\" is out of range for type real",
335 errmsg(
"invalid input syntax for type %s: \"%s\"",
340 while (*endptr !=
'\0' &&
isspace((
unsigned char) *endptr))
346 else if (*endptr !=
'\0')
349 errmsg(
"invalid input syntax for type %s: \"%s\"",
438 struct Node *escontext)
444 while (*num !=
'\0' &&
isspace((
unsigned char) *num))
454 errmsg(
"invalid input syntax for type %s: \"%s\"",
461 if (endptr == num ||
errno != 0)
530 errmsg(
"\"%s\" is out of range for type double precision",
537 errmsg(
"invalid input syntax for type %s: \"%s\"",
542 while (*endptr !=
'\0' &&
isspace((
unsigned char) *endptr))
548 else if (*endptr !=
'\0')
551 errmsg(
"invalid input syntax for type %s: \"%s\"",
1081 if (
isnan(offset) || offset < 0)
1084 errmsg(
"invalid preceding or following size in window function")));
1098 else if (
isnan(base))
1117 (sub ? base > 0 : base < 0))
1127 sum = base - offset;
1129 sum = base + offset;
1157 if (
isnan(offset) || offset < 0)
1160 errmsg(
"invalid preceding or following size in window function")));
1174 else if (
isnan(base))
1193 (sub ? base > 0 : base < 0))
1203 sum = base - offset;
1205 sum = base + offset;
1270 errmsg(
"integer out of range")));
1295 errmsg(
"smallint out of range")));
1344 errmsg(
"integer out of range")));
1369 errmsg(
"smallint out of range")));
1495 errmsg(
"cannot take square root of a negative number")));
1563 errmsg(
"zero raised to a negative power is undefined")));
1567 errmsg(
"a negative number raised to a non-integer power yields a complex result")));
1580 else if (
arg2 > 0.0)
1599 else if (
arg1 > 0.0)
1743 errmsg(
"cannot take logarithm of zero")));
1747 errmsg(
"cannot take logarithm of a negative number")));
1776 errmsg(
"cannot take logarithm of zero")));
1780 errmsg(
"cannot take logarithm of a negative number")));
1813 errmsg(
"input is out of range")));
1844 errmsg(
"input is out of range")));
1939 errmsg(
"input is out of range")));
1966 errmsg(
"input is out of range")));
1994 errmsg(
"input is out of range")));
2021 errmsg(
"input is out of range")));
2072#define INIT_DEGREE_CONSTANTS() \
2074 if (!degree_consts_set) \
2075 init_degree_constants(); \
2168 errmsg(
"input is out of range")));
2205 errmsg(
"input is out of range")));
2375 errmsg(
"input is out of range")));
2431 errmsg(
"input is out of range")));
2496 errmsg(
"input is out of range")));
2553 errmsg(
"input is out of range")));
2744 errmsg(
"input is out of range")));
2768 errmsg(
"input is out of range")));
2777 else if (
arg1 == 1.0)
3883 if (
Sxx == 0 ||
Syy == 0)
4240 errmsg(
"count must be greater than zero")));
4245 errmsg(
"lower and upper bounds cannot be NaN")));
4250 errmsg(
"lower and upper bounds must be finite")));
4259 errmsg(
"integer out of range")));
4261 else if (operand <
bound1)
4294 else if (operand <=
bound2)
4299 errmsg(
"integer out of range")));
4316 errmsg(
"lower bound cannot equal upper bound")));
#define PG_GETARG_ARRAYTYPE_P(n)
#define PG_RETURN_ARRAYTYPE_P(x)
ArrayType * construct_array_builtin(Datum *elems, int nelems, Oid elmtype)
#define FLOAT4_FITS_IN_INT32(num)
#define FLOAT8_FITS_IN_INT32(num)
#define FLOAT4_FITS_IN_INT16(num)
#define FLOAT8_FITS_IN_INT16(num)
int double_to_shortest_decimal_buf(double f, char *result)
int errcode(int sqlerrcode)
#define ereturn(context, dummy_value,...)
#define ereport(elevel,...)
struct SortSupportData * SortSupport
int float_to_shortest_decimal_buf(float f, char *result)
float8 float8in_internal(char *num, char **endptr_p, const char *type_name, const char *orig_string, struct Node *escontext)
Datum float4lt(PG_FUNCTION_ARGS)
Datum dceil(PG_FUNCTION_ARGS)
float8 float_underflow_error_ext(struct Node *escontext)
Datum btfloat4cmp(PG_FUNCTION_ARGS)
Datum float84gt(PG_FUNCTION_ARGS)
Datum dasinh(PG_FUNCTION_ARGS)
Datum float84mi(PG_FUNCTION_ARGS)
static double sind_0_to_30(double x)
Datum dtof(PG_FUNCTION_ARGS)
Datum radians(PG_FUNCTION_ARGS)
pg_noinline void float_zero_divide_error(void)
pg_noinline void float_overflow_error(void)
Datum width_bucket_float8(PG_FUNCTION_ARGS)
Datum dasind(PG_FUNCTION_ARGS)
Datum float8_var_samp(PG_FUNCTION_ARGS)
Datum btfloat84cmp(PG_FUNCTION_ARGS)
Datum ftoi4(PG_FUNCTION_ARGS)
Datum dsind(PG_FUNCTION_ARGS)
Datum datan2(PG_FUNCTION_ARGS)
Datum derfc(PG_FUNCTION_ARGS)
Datum float8div(PG_FUNCTION_ARGS)
Datum float8_regr_syy(PG_FUNCTION_ARGS)
Datum float48gt(PG_FUNCTION_ARGS)
Datum degrees(PG_FUNCTION_ARGS)
Datum btfloat4sortsupport(PG_FUNCTION_ARGS)
Datum dlgamma(PG_FUNCTION_ARGS)
Datum dacosd(PG_FUNCTION_ARGS)
static double acosd_q1(double x)
Datum float8_regr_r2(PG_FUNCTION_ARGS)
Datum float8_regr_combine(PG_FUNCTION_ARGS)
Datum float8_regr_slope(PG_FUNCTION_ARGS)
Datum float8eq(PG_FUNCTION_ARGS)
Datum dtanh(PG_FUNCTION_ARGS)
static double cosd_q1(double x)
Datum dlog10(PG_FUNCTION_ARGS)
Datum float84mul(PG_FUNCTION_ARGS)
static bool degree_consts_set
Datum datanh(PG_FUNCTION_ARGS)
Datum dcosd(PG_FUNCTION_ARGS)
static int btfloat8fastcmp(Datum x, Datum y, SortSupport ssup)
Datum derf(PG_FUNCTION_ARGS)
Datum float4up(PG_FUNCTION_ARGS)
Datum float48pl(PG_FUNCTION_ARGS)
Datum dsinh(PG_FUNCTION_ARGS)
Datum float8_combine(PG_FUNCTION_ARGS)
Datum float8_avg(PG_FUNCTION_ARGS)
Datum float8_covar_pop(PG_FUNCTION_ARGS)
Datum dtan(PG_FUNCTION_ARGS)
Datum float8ge(PG_FUNCTION_ARGS)
Datum float8_stddev_pop(PG_FUNCTION_ARGS)
static double asind_q1(double x)
Datum dround(PG_FUNCTION_ARGS)
Datum float4um(PG_FUNCTION_ARGS)
Datum dlog1(PG_FUNCTION_ARGS)
Datum datan2d(PG_FUNCTION_ARGS)
Datum float4abs(PG_FUNCTION_ARGS)
Datum ftod(PG_FUNCTION_ARGS)
Datum float4mul(PG_FUNCTION_ARGS)
Datum float4le(PG_FUNCTION_ARGS)
Datum dcos(PG_FUNCTION_ARGS)
Datum float8_regr_intercept(PG_FUNCTION_ARGS)
Datum float8out(PG_FUNCTION_ARGS)
Datum float84le(PG_FUNCTION_ARGS)
Datum dexp(PG_FUNCTION_ARGS)
Datum float8pl(PG_FUNCTION_ARGS)
Datum float8lt(PG_FUNCTION_ARGS)
Datum float4gt(PG_FUNCTION_ARGS)
Datum float4out(PG_FUNCTION_ARGS)
#define INIT_DEGREE_CONSTANTS()
Datum dsign(PG_FUNCTION_ARGS)
Datum float8recv(PG_FUNCTION_ARGS)
Datum float4send(PG_FUNCTION_ARGS)
Datum float4ne(PG_FUNCTION_ARGS)
Datum float84eq(PG_FUNCTION_ARGS)
Datum float84lt(PG_FUNCTION_ARGS)
Datum float48mi(PG_FUNCTION_ARGS)
Datum float8le(PG_FUNCTION_ARGS)
Datum dtrunc(PG_FUNCTION_ARGS)
Datum btfloat8cmp(PG_FUNCTION_ARGS)
Datum float8in(PG_FUNCTION_ARGS)
Datum float8ne(PG_FUNCTION_ARGS)
Datum dpow(PG_FUNCTION_ARGS)
Datum float8mi(PG_FUNCTION_ARGS)
static double sind_q1(double x)
Datum ftoi2(PG_FUNCTION_ARGS)
Datum float4mi(PG_FUNCTION_ARGS)
Datum float8_accum(PG_FUNCTION_ARGS)
Datum float48eq(PG_FUNCTION_ARGS)
Datum i2tof(PG_FUNCTION_ARGS)
static float8 one_minus_cos_60
Datum float84pl(PG_FUNCTION_ARGS)
Datum btfloat48cmp(PG_FUNCTION_ARGS)
Datum float48ge(PG_FUNCTION_ARGS)
Datum float84div(PG_FUNCTION_ARGS)
Datum dcotd(PG_FUNCTION_ARGS)
pg_noinline void float_underflow_error(void)
Datum float8smaller(PG_FUNCTION_ARGS)
float8 degree_c_forty_five
Datum dsqrt(PG_FUNCTION_ARGS)
Datum float84ge(PG_FUNCTION_ARGS)
Datum float8_stddev_samp(PG_FUNCTION_ARGS)
Datum datand(PG_FUNCTION_ARGS)
Datum float8larger(PG_FUNCTION_ARGS)
Datum dcbrt(PG_FUNCTION_ARGS)
Datum float4in(PG_FUNCTION_ARGS)
static int btfloat4fastcmp(Datum x, Datum y, SortSupport ssup)
Datum float8_regr_sxy(PG_FUNCTION_ARGS)
Datum float8_var_pop(PG_FUNCTION_ARGS)
Datum float48div(PG_FUNCTION_ARGS)
Datum float84ne(PG_FUNCTION_ARGS)
Datum float4_accum(PG_FUNCTION_ARGS)
Datum float8up(PG_FUNCTION_ARGS)
int float4_cmp_internal(float4 a, float4 b)
Datum float48le(PG_FUNCTION_ARGS)
Datum float8_regr_sxx(PG_FUNCTION_ARGS)
Datum float8_corr(PG_FUNCTION_ARGS)
Datum float4recv(PG_FUNCTION_ARGS)
Datum in_range_float8_float8(PG_FUNCTION_ARGS)
float8 float_overflow_error_ext(struct Node *escontext)
Datum float48ne(PG_FUNCTION_ARGS)
Datum dpi(PG_FUNCTION_ARGS)
float4 float4in_internal(char *num, char **endptr_p, const char *type_name, const char *orig_string, struct Node *escontext)
Datum dacos(PG_FUNCTION_ARGS)
Datum float48lt(PG_FUNCTION_ARGS)
static void init_degree_constants(void)
Datum dgamma(PG_FUNCTION_ARGS)
Datum float8mul(PG_FUNCTION_ARGS)
Datum float4div(PG_FUNCTION_ARGS)
Datum in_range_float4_float8(PG_FUNCTION_ARGS)
Datum dtand(PG_FUNCTION_ARGS)
Datum float8abs(PG_FUNCTION_ARGS)
Datum i4tod(PG_FUNCTION_ARGS)
int is_infinite(double val)
Datum i2tod(PG_FUNCTION_ARGS)
Datum dfloor(PG_FUNCTION_ARGS)
Datum btfloat8sortsupport(PG_FUNCTION_ARGS)
Datum dcosh(PG_FUNCTION_ARGS)
Datum dacosh(PG_FUNCTION_ARGS)
Datum float4ge(PG_FUNCTION_ARGS)
Datum dasin(PG_FUNCTION_ARGS)
Datum i4tof(PG_FUNCTION_ARGS)
Datum datan(PG_FUNCTION_ARGS)
Datum float8gt(PG_FUNCTION_ARGS)
Datum float8_regr_avgx(PG_FUNCTION_ARGS)
Datum float8um(PG_FUNCTION_ARGS)
Datum float8_regr_avgy(PG_FUNCTION_ARGS)
Datum dcot(PG_FUNCTION_ARGS)
Datum dsin(PG_FUNCTION_ARGS)
Datum dtoi4(PG_FUNCTION_ARGS)
Datum float4pl(PG_FUNCTION_ARGS)
Datum float8_covar_samp(PG_FUNCTION_ARGS)
Datum float8send(PG_FUNCTION_ARGS)
Datum float4larger(PG_FUNCTION_ARGS)
Datum dtoi2(PG_FUNCTION_ARGS)
static float8 * check_float8_array(ArrayType *transarray, const char *caller, int n)
static double cosd_0_to_60(double x)
Datum float48mul(PG_FUNCTION_ARGS)
float8 float_zero_divide_error_ext(struct Node *escontext)
Datum float4smaller(PG_FUNCTION_ARGS)
Datum float8_regr_accum(PG_FUNCTION_ARGS)
char * float8out_internal(double num)
int float8_cmp_internal(float8 a, float8 b)
Datum float4eq(PG_FUNCTION_ARGS)
static float8 float8_mul(const float8 val1, const float8 val2)
static float4 float4_div(const float4 val1, const float4 val2)
#define RADIANS_PER_DEGREE
static float4 get_float4_infinity(void)
static bool float4_lt(const float4 val1, const float4 val2)
static float8 float8_pl(const float8 val1, const float8 val2)
static float8 float8_mi(const float8 val1, const float8 val2)
static bool float4_ge(const float4 val1, const float4 val2)
static float4 get_float4_nan(void)
static bool float8_ne(const float8 val1, const float8 val2)
static bool float4_ne(const float4 val1, const float4 val2)
static float4 float4_pl(const float4 val1, const float4 val2)
static bool float4_eq(const float4 val1, const float4 val2)
static float4 float4_mul(const float4 val1, const float4 val2)
static float8 get_float8_infinity(void)
static bool float8_ge(const float8 val1, const float8 val2)
static float4 float4_mi(const float4 val1, const float4 val2)
static bool float8_le(const float8 val1, const float8 val2)
static bool float4_gt(const float4 val1, const float4 val2)
static bool float8_eq(const float8 val1, const float8 val2)
static bool float4_le(const float4 val1, const float4 val2)
static float8 get_float8_nan(void)
static float8 float8_div(const float8 val1, const float8 val2)
static bool float8_lt(const float8 val1, const float8 val2)
static bool float8_gt(const float8 val1, const float8 val2)
#define PG_RETURN_BYTEA_P(x)
#define PG_GETARG_FLOAT8(n)
#define PG_RETURN_FLOAT8(x)
#define PG_GETARG_POINTER(n)
#define PG_RETURN_CSTRING(x)
#define PG_GETARG_CSTRING(n)
#define PG_RETURN_INT16(x)
#define PG_RETURN_INT32(x)
#define PG_GETARG_INT32(n)
#define PG_GETARG_BOOL(n)
#define PG_GETARG_FLOAT4(n)
#define PG_RETURN_FLOAT4(x)
#define PG_RETURN_BOOL(x)
#define PG_GETARG_INT16(n)
static bool pg_add_s32_overflow(int32 a, int32 b, int32 *result)
char * pstrdup(const char *in)
int AggCheckCallContext(FunctionCallInfo fcinfo, MemoryContext *aggcontext)
Datum ascii(PG_FUNCTION_ARGS)
static char buf[DEFAULT_XLOG_SEG_SIZE]
int pg_strfromd(char *str, size_t count, int precision, double value)
int pg_strncasecmp(const char *s1, const char *s2, size_t n)
static float4 DatumGetFloat4(Datum X)
#define Float8GetDatumFast(X)
static float8 DatumGetFloat8(Datum X)
struct StringInfoData * StringInfo
int(* comparator)(Datum x, Datum y, SortSupport ssup)