45#define Int2VectorSize(n) (offsetof(int2vector, values) + (n) * sizeof(int16))
77 char *result = (
char *)
palloc(7);
144 Node *escontext = fcinfo->context;
157 while (*intString && isspace((
unsigned char) *intString))
159 if (*intString ==
'\0')
169 l = strtol(intString, &endp, 10);
171 if (intString == endp)
173 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
174 errmsg(
"invalid input syntax for type %s: \"%s\"",
175 "smallint", intString)));
177 if (errno == ERANGE || l < SHRT_MIN || l > SHRT_MAX)
179 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
180 errmsg(
"value \"%s\" is out of range for type %s", intString,
183 if (*endp && *endp !=
' ')
185 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
186 errmsg(
"invalid input syntax for type %s: \"%s\"",
187 "smallint", intString)));
211 nnums = int2Array->
dim1;
216 rp = result = (
char *)
palloc(nnums * 7 + 1);
217 for (num = 0; num < nnums; num++)
247 locfcinfo->args[0].isnull =
false;
249 locfcinfo->args[1].isnull =
false;
251 locfcinfo->args[2].isnull =
false;
255 Assert(!locfcinfo->isnull);
263 (
errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
264 errmsg(
"invalid int2vector data")));
301 char *result = (
char *)
palloc(12);
354 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
355 errmsg(
"smallint out of range")));
634 (
errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
635 errmsg(
"invalid preceding or following size in window function")));
681 (
errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
682 errmsg(
"invalid preceding or following size in window function")));
716 (
errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
717 errmsg(
"invalid preceding or following size in window function")));
777 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
778 errmsg(
"integer out of range")));
799 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
800 errmsg(
"integer out of range")));
813 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
814 errmsg(
"integer out of range")));
827 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
828 errmsg(
"integer out of range")));
842 (
errcode(ERRCODE_DIVISION_BY_ZERO),
843 errmsg(
"division by zero")));
858 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
859 errmsg(
"integer out of range")));
866 result = arg1 / arg2;
879 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
880 errmsg(
"integer out of range")));
892 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
893 errmsg(
"smallint out of range")));
914 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
915 errmsg(
"smallint out of range")));
928 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
929 errmsg(
"smallint out of range")));
942 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
943 errmsg(
"smallint out of range")));
958 (
errcode(ERRCODE_DIVISION_BY_ZERO),
959 errmsg(
"division by zero")));
974 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
975 errmsg(
"smallint out of range")));
982 result = arg1 / arg2;
996 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
997 errmsg(
"integer out of range")));
1010 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1011 errmsg(
"integer out of range")));
1024 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1025 errmsg(
"integer out of range")));
1038 (
errcode(ERRCODE_DIVISION_BY_ZERO),
1039 errmsg(
"division by zero")));
1057 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1058 errmsg(
"integer out of range")));
1071 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1072 errmsg(
"integer out of range")));
1085 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1086 errmsg(
"integer out of range")));
1100 (
errcode(ERRCODE_DIVISION_BY_ZERO),
1101 errmsg(
"division by zero")));
1116 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1117 errmsg(
"integer out of range")));
1124 result = arg1 / arg2;
1138 (
errcode(ERRCODE_DIVISION_BY_ZERO),
1139 errmsg(
"division by zero")));
1166 (
errcode(ERRCODE_DIVISION_BY_ZERO),
1167 errmsg(
"division by zero")));
1198 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1199 errmsg(
"integer out of range")));
1200 result = (arg1 < 0) ? -arg1 : arg1;
1212 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1213 errmsg(
"smallint out of range")));
1214 result = (arg1 < 0) ? -arg1 : arg1;
1248 a1 = (arg1 < 0) ? arg1 : -arg1;
1249 a2 = (arg2 < 0) ? arg2 : -arg2;
1262 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1263 errmsg(
"integer out of range")));
1321 if (arg1 == 0 || arg2 == 0)
1330 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1331 errmsg(
"integer out of range")));
1336 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1337 errmsg(
"integer out of range")));
1528 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1529 errmsg(
"step size cannot equal zero")));
1617 ((
Const *) arg1)->constisnull) ||
1619 ((
Const *) arg2)->constisnull) ||
1620 (arg3 != NULL &&
IsA(arg3,
Const) &&
1621 ((
Const *) arg3)->constisnull))
1628 (arg3 == NULL ||
IsA(arg3,
Const)))
1641 req->
rows = floor((finish -
start + step) / step);
Datum array_recv(PG_FUNCTION_ARGS)
Datum array_send(PG_FUNCTION_ARGS)
#define Assert(condition)
Node * estimate_expression_value(PlannerInfo *root, Node *node)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereturn(context, dummy_value,...)
#define ereport(elevel,...)
#define PG_RETURN_BYTEA_P(x)
#define PG_GETARG_POINTER(n)
#define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo)
#define PG_RETURN_CSTRING(x)
#define PG_GETARG_DATUM(n)
#define LOCAL_FCINFO(name, nargs)
#define PG_GETARG_CSTRING(n)
#define PG_GETARG_INT64(n)
#define PG_RETURN_INT16(x)
#define PG_RETURN_INT32(x)
#define PG_GETARG_INT32(n)
#define PG_GETARG_BOOL(n)
#define DirectFunctionCall5(func, arg1, arg2, arg3, arg4, arg5)
#define PG_RETURN_POINTER(x)
#define PG_RETURN_BOOL(x)
#define PG_GETARG_INT16(n)
#define SRF_IS_FIRSTCALL()
#define SRF_PERCALL_SETUP()
#define SRF_RETURN_NEXT(_funcctx, _result)
#define SRF_FIRSTCALL_INIT()
#define SRF_RETURN_DONE(_funcctx)
static const FormData_pg_attribute a1
static const FormData_pg_attribute a2
Datum int4div(PG_FUNCTION_ARGS)
Datum int4shl(PG_FUNCTION_ARGS)
Datum int2vectorrecv(PG_FUNCTION_ARGS)
Datum int2not(PG_FUNCTION_ARGS)
Datum int4pl(PG_FUNCTION_ARGS)
Datum int2xor(PG_FUNCTION_ARGS)
Datum generate_series_int4(PG_FUNCTION_ARGS)
Datum int4recv(PG_FUNCTION_ARGS)
Datum int4um(PG_FUNCTION_ARGS)
Datum int4gt(PG_FUNCTION_ARGS)
Datum int24eq(PG_FUNCTION_ARGS)
Datum int2lt(PG_FUNCTION_ARGS)
Datum int24mi(PG_FUNCTION_ARGS)
Datum int2out(PG_FUNCTION_ARGS)
Datum int2eq(PG_FUNCTION_ARGS)
Datum int42eq(PG_FUNCTION_ARGS)
Datum int2ge(PG_FUNCTION_ARGS)
Datum int2up(PG_FUNCTION_ARGS)
Datum int4gcd(PG_FUNCTION_ARGS)
Datum int42ge(PG_FUNCTION_ARGS)
Datum int42mul(PG_FUNCTION_ARGS)
Datum int24gt(PG_FUNCTION_ARGS)
Datum int2le(PG_FUNCTION_ARGS)
Datum int2abs(PG_FUNCTION_ARGS)
#define Int2VectorSize(n)
Datum int4lt(PG_FUNCTION_ARGS)
Datum int2um(PG_FUNCTION_ARGS)
Datum int2shl(PG_FUNCTION_ARGS)
Datum in_range_int2_int8(PG_FUNCTION_ARGS)
Datum int42div(PG_FUNCTION_ARGS)
Datum int2mi(PG_FUNCTION_ARGS)
Datum int2ne(PG_FUNCTION_ARGS)
Datum int24le(PG_FUNCTION_ARGS)
Datum int2send(PG_FUNCTION_ARGS)
Datum int2mul(PG_FUNCTION_ARGS)
Datum int2smaller(PG_FUNCTION_ARGS)
Datum int2mod(PG_FUNCTION_ARGS)
int2vector * buildint2vector(const int16 *int2s, int n)
Datum int2in(PG_FUNCTION_ARGS)
Datum int24mul(PG_FUNCTION_ARGS)
Datum int42gt(PG_FUNCTION_ARGS)
Datum int4lcm(PG_FUNCTION_ARGS)
Datum in_range_int4_int8(PG_FUNCTION_ARGS)
Datum int2div(PG_FUNCTION_ARGS)
Datum in_range_int2_int2(PG_FUNCTION_ARGS)
Datum int4in(PG_FUNCTION_ARGS)
Datum int2shr(PG_FUNCTION_ARGS)
Datum in_range_int2_int4(PG_FUNCTION_ARGS)
static int32 int4gcd_internal(int32 arg1, int32 arg2)
Datum int2vectorout(PG_FUNCTION_ARGS)
Datum i4toi2(PG_FUNCTION_ARGS)
Datum int4ge(PG_FUNCTION_ARGS)
Datum int4and(PG_FUNCTION_ARGS)
Datum int4send(PG_FUNCTION_ARGS)
Datum int24ge(PG_FUNCTION_ARGS)
Datum in_range_int4_int2(PG_FUNCTION_ARGS)
Datum int2vectorin(PG_FUNCTION_ARGS)
Datum bool_int4(PG_FUNCTION_ARGS)
Datum int4inc(PG_FUNCTION_ARGS)
Datum int4shr(PG_FUNCTION_ARGS)
Datum int4larger(PG_FUNCTION_ARGS)
Datum int24ne(PG_FUNCTION_ARGS)
Datum int2gt(PG_FUNCTION_ARGS)
Datum int24lt(PG_FUNCTION_ARGS)
Datum int42pl(PG_FUNCTION_ARGS)
Datum in_range_int4_int4(PG_FUNCTION_ARGS)
Datum int4ne(PG_FUNCTION_ARGS)
Datum int42le(PG_FUNCTION_ARGS)
Datum i2toi4(PG_FUNCTION_ARGS)
Datum int4smaller(PG_FUNCTION_ARGS)
Datum int24pl(PG_FUNCTION_ARGS)
Datum int4_bool(PG_FUNCTION_ARGS)
Datum int4mod(PG_FUNCTION_ARGS)
Datum int24div(PG_FUNCTION_ARGS)
Datum int4xor(PG_FUNCTION_ARGS)
Datum generate_series_step_int4(PG_FUNCTION_ARGS)
Datum int2larger(PG_FUNCTION_ARGS)
Datum int2and(PG_FUNCTION_ARGS)
Datum int4not(PG_FUNCTION_ARGS)
Datum int4abs(PG_FUNCTION_ARGS)
Datum int4out(PG_FUNCTION_ARGS)
Datum generate_series_int4_support(PG_FUNCTION_ARGS)
Datum int4mul(PG_FUNCTION_ARGS)
Datum int4eq(PG_FUNCTION_ARGS)
Datum int4le(PG_FUNCTION_ARGS)
Datum int42ne(PG_FUNCTION_ARGS)
Datum int4mi(PG_FUNCTION_ARGS)
Datum int42lt(PG_FUNCTION_ARGS)
Datum int2pl(PG_FUNCTION_ARGS)
Datum int4up(PG_FUNCTION_ARGS)
Datum int2vectorsend(PG_FUNCTION_ARGS)
Datum int2recv(PG_FUNCTION_ARGS)
Datum int42mi(PG_FUNCTION_ARGS)
Datum int4or(PG_FUNCTION_ARGS)
Datum int2or(PG_FUNCTION_ARGS)
static bool pg_sub_s16_overflow(int16 a, int16 b, int16 *result)
static bool pg_mul_s32_overflow(int32 a, int32 b, int32 *result)
static bool pg_mul_s16_overflow(int16 a, int16 b, int16 *result)
static bool pg_add_s16_overflow(int16 a, int16 b, int16 *result)
static bool pg_sub_s32_overflow(int32 a, int32 b, int32 *result)
static bool pg_add_s64_overflow(int64 a, int64 b, int64 *result)
static bool pg_add_s32_overflow(int32 a, int32 b, int32 *result)
void * repalloc(void *pointer, Size size)
void * palloc0(Size size)
static bool is_funcclause(const void *clause)
#define IsA(nodeptr, _type_)
int pg_ltoa(int32 value, char *a)
int32 pg_strtoint32_safe(const char *s, Node *escontext)
int pg_itoa(int16 i, char *a)
int16 pg_strtoint16_safe(const char *s, Node *escontext)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
static int list_length(const List *l)
static Datum PointerGetDatum(const void *X)
static Datum ObjectIdGetDatum(Oid X)
static Pointer DatumGetPointer(Datum X)
static Datum Int32GetDatum(int32 X)
static int32 DatumGetInt32(Datum X)
StringInfoData * StringInfo
MemoryContext multi_call_memory_ctx
struct PlannerInfo * root
int16 values[FLEXIBLE_ARRAY_MEMBER]
static uint32 gcd(uint32 a, uint32 b)
#define SET_VARSIZE(PTR, len)