57 const char *ptr =
str;
70 while (*ptr && isspace((
unsigned char) *ptr))
83 if (
unlikely(!isdigit((
unsigned char) *ptr)))
87 while (*ptr && isdigit((
unsigned char) *ptr))
89 int8 digit = (*ptr++ -
'0');
97 while (*ptr !=
'\0' && isspace((
unsigned char) *ptr))
117 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
118 errmsg(
"value \"%s\" is out of range for type %s",
125 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
126 errmsg(
"invalid input syntax for type %s: \"%s\"",
139 (void)
scanint8(str,
false, &result);
161 memcpy(result, buf, len);
498 (
errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
499 errmsg(
"invalid preceding or following size in window function")));
533 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
534 errmsg(
"bigint out of range")));
556 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
557 errmsg(
"bigint out of range")));
570 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
571 errmsg(
"bigint out of range")));
584 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
585 errmsg(
"bigint out of range")));
599 (
errcode(ERRCODE_DIVISION_BY_ZERO),
600 errmsg(
"division by zero")));
615 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
616 errmsg(
"bigint out of range")));
623 result = arg1 / arg2;
639 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
640 errmsg(
"bigint out of range")));
641 result = (arg1 < 0) ? -arg1 : arg1;
657 (
errcode(ERRCODE_DIVISION_BY_ZERO),
658 errmsg(
"division by zero")));
707 a1 = (arg1 < 0) ? arg1 : -arg1;
708 a2 = (arg2 < 0) ? arg2 : -arg2;
721 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
722 errmsg(
"bigint out of range")));
780 if (arg1 == 0 || arg2 == 0)
789 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
790 errmsg(
"bigint out of range")));
795 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
796 errmsg(
"bigint out of range")));
814 #ifndef USE_FLOAT8_BYVAL 821 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
822 errmsg(
"bigint out of range")));
835 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
836 errmsg(
"bigint out of range")));
852 #ifndef USE_FLOAT8_BYVAL 859 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
860 errmsg(
"bigint out of range")));
872 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
873 errmsg(
"bigint out of range")));
915 result = ((arg1 > arg2) ? arg1 : arg2);
927 result = ((arg1 < arg2) ? arg1 : arg2);
941 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
942 errmsg(
"bigint out of range")));
955 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
956 errmsg(
"bigint out of range")));
969 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
970 errmsg(
"bigint out of range")));
984 (
errcode(ERRCODE_DIVISION_BY_ZERO),
985 errmsg(
"division by zero")));
1000 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1001 errmsg(
"bigint out of range")));
1008 result = arg1 / arg2;
1022 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1023 errmsg(
"bigint out of range")));
1036 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1037 errmsg(
"bigint out of range")));
1050 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1051 errmsg(
"bigint out of range")));
1064 (
errcode(ERRCODE_DIVISION_BY_ZERO),
1065 errmsg(
"division by zero")));
1083 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1084 errmsg(
"bigint out of range")));
1097 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1098 errmsg(
"bigint out of range")));
1111 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1112 errmsg(
"bigint out of range")));
1126 (
errcode(ERRCODE_DIVISION_BY_ZERO),
1127 errmsg(
"division by zero")));
1142 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1143 errmsg(
"bigint out of range")));
1150 result = arg1 / arg2;
1164 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1165 errmsg(
"bigint out of range")));
1178 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1179 errmsg(
"bigint out of range")));
1192 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1193 errmsg(
"bigint out of range")));
1206 (
errcode(ERRCODE_DIVISION_BY_ZERO),
1207 errmsg(
"division by zero")));
1298 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1299 errmsg(
"integer out of range")));
1319 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1320 errmsg(
"smallint out of range")));
1354 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1355 errmsg(
"bigint out of range")));
1389 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1390 errmsg(
"bigint out of range")));
1402 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1403 errmsg(
"OID out of range")));
1445 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1446 errmsg(
"step size cannot equal zero")));
1534 ((
Const *) arg1)->constisnull) ||
1536 ((
Const *) arg2)->constisnull) ||
1537 (arg3 != NULL &&
IsA(arg3,
Const) &&
1538 ((
Const *) arg3)->constisnull))
1545 (arg3 == NULL ||
IsA(arg3,
Const)))
1558 req->
rows = floor((finish - start + step) / step);
#define PG_GETARG_FLOAT8(n)
Datum int8lt(PG_FUNCTION_ARGS)
#define PG_RETURN_POINTER(x)
Datum int8ge(PG_FUNCTION_ARGS)
#define PG_GETARG_INT32(n)
#define IsA(nodeptr, _type_)
#define PG_RETURN_FLOAT4(x)
Datum int84ge(PG_FUNCTION_ARGS)
Datum int82mul(PG_FUNCTION_ARGS)
Datum generate_series_step_int8(PG_FUNCTION_ARGS)
Datum int82eq(PG_FUNCTION_ARGS)
Datum int8xor(PG_FUNCTION_ARGS)
Node * estimate_expression_value(PlannerInfo *root, Node *node)
Datum int82ge(PG_FUNCTION_ARGS)
Datum int48div(PG_FUNCTION_ARGS)
static bool pg_sub_s64_overflow(int64 a, int64 b, int64 *result)
Datum int8lcm(PG_FUNCTION_ARGS)
#define PG_RETURN_INT64(x)
#define SRF_IS_FIRSTCALL()
Datum int28gt(PG_FUNCTION_ARGS)
Datum int8pl(PG_FUNCTION_ARGS)
StringInfoData * StringInfo
#define PG_RETURN_FLOAT8(x)
Datum generate_series_int8(PG_FUNCTION_ARGS)
Datum int28eq(PG_FUNCTION_ARGS)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
#define PG_RETURN_INT32(x)
Datum int84div(PG_FUNCTION_ARGS)
#define PG_RETURN_INT16(x)
int errcode(int sqlerrcode)
Datum int28div(PG_FUNCTION_ARGS)
Datum int8le(PG_FUNCTION_ARGS)
Datum int8mi(PG_FUNCTION_ARGS)
Datum generate_series_int8_support(PG_FUNCTION_ARGS)
Datum int82pl(PG_FUNCTION_ARGS)
#define PG_GETARG_POINTER(n)
Datum int82mi(PG_FUNCTION_ARGS)
#define PG_GETARG_BOOL(n)
#define PG_RETURN_BYTEA_P(x)
#define SRF_PERCALL_SETUP()
Datum int48mi(PG_FUNCTION_ARGS)
Datum i8tooid(PG_FUNCTION_ARGS)
Datum int48ge(PG_FUNCTION_ARGS)
static bool is_funcclause(const void *clause)
Datum int8larger(PG_FUNCTION_ARGS)
Datum int8smaller(PG_FUNCTION_ARGS)
struct PlannerInfo * root
Datum ftoi8(PG_FUNCTION_ARGS)
#define SRF_RETURN_NEXT(_funcctx, _result)
Datum in_range_int8_int8(PG_FUNCTION_ARGS)
Datum int8inc_float8_float8(PG_FUNCTION_ARGS)
static const FormData_pg_attribute a2
Datum int48eq(PG_FUNCTION_ARGS)
Datum int82le(PG_FUNCTION_ARGS)
Datum int8and(PG_FUNCTION_ARGS)
Datum int28ge(PG_FUNCTION_ARGS)
#define FLOAT8_FITS_IN_INT64(num)
Datum int8eq(PG_FUNCTION_ARGS)
Datum int8gt(PG_FUNCTION_ARGS)
Datum int82gt(PG_FUNCTION_ARGS)
Datum int8mul(PG_FUNCTION_ARGS)
Datum int8inc(PG_FUNCTION_ARGS)
Datum dtoi8(PG_FUNCTION_ARGS)
Datum int8div(PG_FUNCTION_ARGS)
Datum int48gt(PG_FUNCTION_ARGS)
Datum int84lt(PG_FUNCTION_ARGS)
Datum Int64GetDatum(int64 X)
#define PG_GETARG_FLOAT4(n)
Datum int48lt(PG_FUNCTION_ARGS)
Datum int8um(PG_FUNCTION_ARGS)
Datum int84le(PG_FUNCTION_ARGS)
Datum int84mul(PG_FUNCTION_ARGS)
Datum int8dec(PG_FUNCTION_ARGS)
Datum int48pl(PG_FUNCTION_ARGS)
Datum int8dec_any(PG_FUNCTION_ARGS)
Datum int8ne(PG_FUNCTION_ARGS)
Datum int84ne(PG_FUNCTION_ARGS)
#define PG_RETURN_BOOL(x)
Datum int82div(PG_FUNCTION_ARGS)
Datum int82(PG_FUNCTION_ARGS)
Datum int82lt(PG_FUNCTION_ARGS)
#define PG_GETARG_INT16(n)
Datum int84gt(PG_FUNCTION_ARGS)
Datum int28ne(PG_FUNCTION_ARGS)
#define FLOAT4_FITS_IN_INT64(num)
Datum int8shr(PG_FUNCTION_ARGS)
static int64 int8gcd_internal(int64 arg1, int64 arg2)
static bool pg_add_s64_overflow(int64 a, int64 b, int64 *result)
#define ereport(elevel,...)
Datum int28le(PG_FUNCTION_ARGS)
Datum int84pl(PG_FUNCTION_ARGS)
Datum int8shl(PG_FUNCTION_ARGS)
static bool pg_mul_s64_overflow(int64 a, int64 b, int64 *result)
Datum int48mul(PG_FUNCTION_ARGS)
Datum i8tod(PG_FUNCTION_ARGS)
#define PG_RETURN_CSTRING(x)
MemoryContext multi_call_memory_ctx
Datum int82ne(PG_FUNCTION_ARGS)
Datum int8recv(PG_FUNCTION_ARGS)
Datum int28mul(PG_FUNCTION_ARGS)
static int list_length(const List *l)
Datum int8send(PG_FUNCTION_ARGS)
int AggCheckCallContext(FunctionCallInfo fcinfo, MemoryContext *aggcontext)
Datum int84eq(PG_FUNCTION_ARGS)
Datum int8in(PG_FUNCTION_ARGS)
Datum int28lt(PG_FUNCTION_ARGS)
Datum int8abs(PG_FUNCTION_ARGS)
Datum int28(PG_FUNCTION_ARGS)
Datum int84(PG_FUNCTION_ARGS)
Datum i8tof(PG_FUNCTION_ARGS)
Datum int84mi(PG_FUNCTION_ARGS)
int errmsg(const char *fmt,...)
int pg_lltoa(int64 value, char *a)
Datum int8or(PG_FUNCTION_ARGS)
Datum int8gcd(PG_FUNCTION_ARGS)
Datum int48(PG_FUNCTION_ARGS)
Datum int28pl(PG_FUNCTION_ARGS)
static uint32 gcd(uint32 a, uint32 b)
#define PG_GETARG_CSTRING(n)
Datum int8inc_any(PG_FUNCTION_ARGS)
Datum int48ne(PG_FUNCTION_ARGS)
static const FormData_pg_attribute a1
Datum int8not(PG_FUNCTION_ARGS)
Datum int28mi(PG_FUNCTION_ARGS)
#define PG_GETARG_INT64(n)
Datum int48le(PG_FUNCTION_ARGS)
Datum oidtoi8(PG_FUNCTION_ARGS)
Datum int8out(PG_FUNCTION_ARGS)
Datum int8up(PG_FUNCTION_ARGS)
Datum int8mod(PG_FUNCTION_ARGS)
#define SRF_RETURN_DONE(_funcctx)
bool scanint8(const char *str, bool errorOK, int64 *result)
#define SRF_FIRSTCALL_INIT()