80#define IA_TOTAL_COUNT(ia) \
81 ((ia)->N + (ia)->pInfcount + (ia)->nInfcount)
108 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
109 errmsg(
"invalid type modifier")));
120 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
121 errmsg(
"TIMESTAMP(%d)%s precision must not be negative",
122 typmod, (istz ?
" WITH TIME ZONE" :
""))));
126 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
127 errmsg(
"TIMESTAMP(%d)%s precision reduced to maximum allowed, %d",
128 typmod, (istz ?
" WITH TIME ZONE" :
""),
140 const char *tz = istz ?
" with time zone" :
" without time zone";
143 return psprintf(
"(%d)%s", (
int) typmod, tz);
164 Node *escontext = fcinfo->context;
182 &dtype,
tm, &fsec, &tz, &extra);
194 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
195 errmsg(
"timestamp out of range: \"%s\"",
str)));
211 elog(
ERROR,
"unexpected dtype %d while parsing timestamp \"%s\"",
240 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
241 errmsg(
"timestamp out of range")));
272 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
273 errmsg(
"timestamp out of range")));
387 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
388 errmsg(
"timestamp(%d) precision must be between %d and %d",
393 *time = ((*time + TimestampOffsets[typmod]) / TimestampScales[typmod]) *
394 TimestampScales[typmod];
398 *time = -((((-*time) + TimestampOffsets[typmod]) / TimestampScales[typmod])
399 * TimestampScales[typmod]);
417 Node *escontext = fcinfo->context;
435 &dtype,
tm, &fsec, &tz, &extra);
448 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
449 errmsg(
"timestamp out of range: \"%s\"",
str)));
465 elog(
ERROR,
"unexpected dtype %d while parsing timestamptz \"%s\"",
501 if (isdigit((
unsigned char) *tzname))
503 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
504 errmsg(
"invalid input syntax for type %s: \"%s\"",
505 "numeric time zone", tzname),
506 errhint(
"Numeric time zones must have \"-\" or \"+\" as first character.")));
517 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
518 errmsg(
"numeric time zone \"%s\" out of range", tzname)));
521 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
522 errmsg(
"time zone \"%s\" not recognized", tzname)));
567 int hour,
int min,
double sec)
591 (
errcode(ERRCODE_DATETIME_FIELD_OVERFLOW),
592 errmsg(
"date field value out of range: %d-%02d-%02d",
597 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
598 errmsg(
"date out of range: %d-%02d-%02d",
606 (
errcode(ERRCODE_DATETIME_FIELD_OVERFLOW),
607 errmsg(
"time field value out of range: %d:%02d:%02g",
617 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
618 errmsg(
"timestamp out of range: %d-%02d-%02d %d:%02d:%02g",
625 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
626 errmsg(
"timestamp out of range: %d-%02d-%02d %d:%02d:%02g",
698 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
699 errmsg(
"timestamp out of range")));
707 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
708 errmsg(
"timestamp out of range")));
726 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
727 errmsg(
"timestamp cannot be NaN")));
744 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
745 errmsg(
"timestamp out of range: \"%g\"", seconds)));
756 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
757 errmsg(
"timestamp out of range: \"%g\"",
785 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
786 errmsg(
"timestamp out of range")));
818 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
819 errmsg(
"timestamp out of range")));
891 Node *escontext = fcinfo->context;
940 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
941 errmsg(
"interval out of range")));
953 elog(
ERROR,
"unexpected dtype %d while parsing interval \"%s\"",
1077 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1078 errmsg(
"invalid INTERVAL type modifier")));
1093 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1094 errmsg(
"INTERVAL(%d) precision must not be negative",
1099 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1100 errmsg(
"INTERVAL(%d) precision reduced to maximum allowed, %d",
1110 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1111 errmsg(
"invalid INTERVAL type modifier")));
1122 char *res = (
char *)
palloc(64);
1125 const char *fieldstr;
1142 fieldstr =
" month";
1151 fieldstr =
" minute";
1154 fieldstr =
" second";
1157 fieldstr =
" year to month";
1160 fieldstr =
" day to hour";
1163 fieldstr =
" day to minute";
1166 fieldstr =
" day to second";
1169 fieldstr =
" hour to minute";
1172 fieldstr =
" hour to second";
1175 fieldstr =
" minute to second";
1181 elog(
ERROR,
"invalid INTERVAL typmod: 0x%x", typmod);
1187 snprintf(res, 64,
"%s(%d)", fieldstr, precision);
1241 elog(
ERROR,
"invalid INTERVAL typmod: 0x%x", typmod);
1284 int old_least_field;
1285 int new_least_field;
1303 noop = (new_least_field <= old_least_field) &&
1304 (old_least_field > 0 ||
1306 new_precis >= old_precis);
1483 elog(
ERROR,
"unrecognized interval typmod: %d", typmod);
1490 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1491 errmsg(
"interval(%d) precision must be between %d and %d",
1497 IntervalOffsets[precision],
1500 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
1501 errmsg(
"interval out of range")));
1507 IntervalOffsets[precision],
1510 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
1511 errmsg(
"interval out of range")));
1539 if (isinf(secs) || isnan(secs))
1571 errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
1572 errmsg(
"interval out of range"));
1588 elog(
ERROR,
"invalid argument for EncodeSpecialTimestamp");
1599 elog(
ERROR,
"invalid argument for EncodeSpecialInterval");
1716 long *secs,
int *microsecs)
1760 return (
long) INT_MAX;
1761 if (diff >= (INT_MAX *
INT64CONST(1000) - 999))
1762 return (
long) INT_MAX;
1764 return (
long) ((diff + 999) / 1000);
1799 return (secs >= threshold_sec);
1911 if (attimezone == NULL)
1927 if (date < 0 || date > (
Timestamp) INT_MAX)
2056 itm->
tm_min = (int) tfrac;
2059 itm->
tm_sec = (int) tfrac;
2075 if (total_months > INT_MAX || total_months < INT_MIN)
2113 if (total_months > INT_MAX || total_months < INT_MIN)
2170 elog(
ERROR,
"could not convert epoch to timestamp: %m");
2206 return (dt1 < dt2) ? -1 : ((dt1 > dt2) ? 1 : 0);
2682#define TIMESTAMP_GT(t1,t2) \
2683 DatumGetBool(DirectFunctionCall2(timestamp_gt,t1,t2))
2684#define TIMESTAMP_LT(t1,t2) \
2685 DatumGetBool(DirectFunctionCall2(timestamp_lt,t1,t2))
2700 else if (!te1IsNull)
2720 else if (!te2IsNull)
2776 if (te1IsNull || te2IsNull)
2841 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
2842 errmsg(
"interval out of range")));
2850 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
2851 errmsg(
"interval out of range")));
2865 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
2866 errmsg(
"interval out of range")));
2939 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
2940 errmsg(
"interval out of range")));
2956 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
2957 errmsg(
"interval out of range")));
2965 else if (
result->month < 0 &&
3013 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3014 errmsg(
"interval out of range")));
3056 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3057 errmsg(
"interval out of range")));
3100 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3101 errmsg(
"timestamp out of range")));
3109 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3110 errmsg(
"timestamp out of range")));
3118 if (span->
month != 0)
3126 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3127 errmsg(
"timestamp out of range")));
3131 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3132 errmsg(
"timestamp out of range")));
3150 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3151 errmsg(
"timestamp out of range")));
3163 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3164 errmsg(
"timestamp out of range")));
3174 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3175 errmsg(
"timestamp out of range")));
3180 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3181 errmsg(
"timestamp out of range")));
3186 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3187 errmsg(
"timestamp out of range")));
3191 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3192 errmsg(
"timestamp out of range")));
3244 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3245 errmsg(
"timestamp out of range")));
3253 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3254 errmsg(
"timestamp out of range")));
3263 if (attimezone == NULL)
3266 if (span->
month != 0)
3274 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3275 errmsg(
"timestamp out of range")));
3279 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3280 errmsg(
"timestamp out of range")));
3300 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3301 errmsg(
"timestamp out of range")));
3313 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3314 errmsg(
"timestamp out of range")));
3327 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3328 errmsg(
"timestamp out of range")));
3335 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3336 errmsg(
"timestamp out of range")));
3341 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3342 errmsg(
"timestamp out of range")));
3346 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3347 errmsg(
"timestamp out of range")));
3434 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3435 errmsg(
"interval out of range")));
3492 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3493 errmsg(
"interval out of range")));
3515 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3516 errmsg(
"interval out of range")));
3524 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3525 errmsg(
"interval out of range")));
3548 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3549 errmsg(
"interval out of range")));
3571 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3572 errmsg(
"interval out of range")));
3580 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3581 errmsg(
"interval out of range")));
3606 double month_remainder_days,
3610 orig_day = span->
day;
3643 if (factor * isign < 0)
3651 result_double = span->
month * factor;
3656 result_double = span->
day * factor;
3680 month_remainder_days =
TSROUND(month_remainder_days);
3681 sec_remainder = (orig_day * factor -
result->day +
3682 month_remainder_days - (int) month_remainder_days) *
SECS_PER_DAY;
3683 sec_remainder =
TSROUND(sec_remainder);
3715 errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3716 errmsg(
"interval out of range"));
3736 double month_remainder_days,
3740 orig_day = span->
day;
3747 (
errcode(ERRCODE_DIVISION_BY_ZERO),
3748 errmsg(
"division by zero")));
3773 result_double = span->
month / factor;
3778 result_double = span->
day / factor;
3787 month_remainder_days =
TSROUND(month_remainder_days);
3788 sec_remainder = (orig_day / factor -
result->day +
3789 month_remainder_days - (int) month_remainder_days) *
SECS_PER_DAY;
3790 sec_remainder =
TSROUND(sec_remainder);
3816 errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
3817 errmsg(
"interval out of range"));
3844 (
errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
3845 errmsg(
"invalid preceding or following size in window function")));
3881 (
errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
3882 errmsg(
"invalid preceding or following size in window function")));
3922 (
errcode(ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE),
3923 errmsg(
"invalid preceding or following size in window function")));
3968 elog(
ERROR,
"aggregate function called in non-aggregate context");
4029 memset(&
state->sumX, 0,
sizeof(
state->sumX));
4076 state1->
N = state2->
N;
4087 state1->
N += state2->
N;
4111 elog(
ERROR,
"aggregate function called in non-aggregate context");
4148 elog(
ERROR,
"aggregate function called in non-aggregate context");
4192 elog(
ERROR,
"interval_avg_accum_inv called with NULL state");
4217 if (
state->pInfcount > 0 ||
state->nInfcount > 0)
4221 if (
state->pInfcount > 0 &&
state->nInfcount > 0)
4223 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4224 errmsg(
"interval out of range")));
4227 if (
state->pInfcount > 0)
4258 if (
state->pInfcount > 0 &&
state->nInfcount > 0)
4260 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4261 errmsg(
"interval out of range")));
4265 if (
state->pInfcount > 0)
4267 else if (
state->nInfcount > 0)
4308 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4309 errmsg(
"interval out of range")));
4317 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4318 errmsg(
"interval out of range")));
4326 else if (
timestamp2tm(dt1, NULL, tm1, &fsec1, NULL, NULL) == 0 &&
4330 tm->tm_usec = fsec1 - fsec2;
4341 tm->tm_usec = -
tm->tm_usec;
4351 while (
tm->tm_usec < 0)
4398 tm->tm_usec = -
tm->tm_usec;
4409 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4410 errmsg(
"interval out of range")));
4414 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4415 errmsg(
"timestamp out of range")));
4456 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4457 errmsg(
"interval out of range")));
4465 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4466 errmsg(
"interval out of range")));
4474 else if (
timestamp2tm(dt1, &tz1, tm1, &fsec1, NULL, NULL) == 0 &&
4478 tm->tm_usec = fsec1 - fsec2;
4489 tm->tm_usec = -
tm->tm_usec;
4499 while (
tm->tm_usec < 0)
4550 tm->tm_usec = -
tm->tm_usec;
4561 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4562 errmsg(
"interval out of range")));
4566 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4567 errmsg(
"timestamp out of range")));
4598 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4599 errmsg(
"origin out of range")));
4603 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4604 errmsg(
"timestamps cannot be binned into infinite intervals")));
4606 if (stride->
month != 0)
4608 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
4609 errmsg(
"timestamps cannot be binned into intervals containing months or years")));
4614 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4615 errmsg(
"interval out of range")));
4617 if (stride_usecs <= 0)
4619 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4620 errmsg(
"stride must be greater than zero")));
4624 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4625 errmsg(
"interval out of range")));
4628 tm_modulo = tm_diff % stride_usecs;
4629 tm_delta = tm_diff - tm_modulo;
4630 result = origin + tm_delta;
4642 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4643 errmsg(
"timestamp out of range")));
4699 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
4700 errmsg(
"unit \"%s\" not supported for type %s",
4708 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4709 errmsg(
"timestamp out of range")));
4782 fsec = (fsec / 1000) * 1000;
4790 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
4791 errmsg(
"unit \"%s\" not supported for type %s",
4798 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4799 errmsg(
"timestamp out of range")));
4804 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
4805 errmsg(
"unit \"%s\" not recognized for type %s",
4833 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4834 errmsg(
"origin out of range")));
4838 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4839 errmsg(
"timestamps cannot be binned into infinite intervals")));
4841 if (stride->
month != 0)
4843 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
4844 errmsg(
"timestamps cannot be binned into intervals containing months or years")));
4849 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4850 errmsg(
"interval out of range")));
4852 if (stride_usecs <= 0)
4854 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4855 errmsg(
"stride must be greater than zero")));
4859 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4860 errmsg(
"interval out of range")));
4863 tm_modulo = tm_diff % stride_usecs;
4864 tm_delta = tm_diff - tm_modulo;
4865 result = origin + tm_delta;
4877 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4878 errmsg(
"timestamp out of range")));
4897 bool redotz =
false;
4938 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
4939 errmsg(
"unit \"%s\" not supported for type %s",
4947 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
4948 errmsg(
"timestamp out of range")));
5032 fsec = (fsec / 1000) * 1000;
5039 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
5040 errmsg(
"unit \"%s\" not supported for type %s",
5050 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
5051 errmsg(
"timestamp out of range")));
5056 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
5057 errmsg(
"unit \"%s\" not recognized for type %s",
5154 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
5155 errmsg(
"unit \"%s\" not supported for type %s",
5199 tm->tm_usec = (
tm->tm_usec / 1000) * 1000;
5206 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
5207 errmsg(
"unit \"%s\" not supported for type %s",
5214 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
5215 errmsg(
"interval out of range")));
5220 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
5221 errmsg(
"unit \"%s\" not recognized for type %s",
5244 day4 =
date2j(year, 1, 4);
5247 day0 =
j2day(day4 - 1);
5249 return ((week - 1) * 7) + (day4 - day0);
5281 j2date(jday, year, mon, mday);
5297 dayn =
date2j(year, mon, mday);
5300 day4 =
date2j(year, 1, 4);
5303 day0 =
j2day(day4 - 1);
5309 if (dayn < day4 - day0)
5311 day4 =
date2j(year - 1, 1, 4);
5314 day0 =
j2day(day4 - 1);
5317 week = (dayn - (day4 - day0)) / 7 + 1;
5325 day4 =
date2j(year + 1, 1, 4);
5328 day0 =
j2day(day4 - 1);
5330 if (dayn >= day4 - day0)
5331 week = (dayn - (day4 - day0)) / 7 + 1;
5352 dayn =
date2j(year, mon, mday);
5355 day4 =
date2j(year, 1, 4);
5358 day0 =
j2day(day4 - 1);
5364 if (dayn < day4 - day0)
5366 day4 =
date2j(year - 1, 1, 4);
5369 day0 =
j2day(day4 - 1);
5374 week = (dayn - (day4 - day0)) / 7 + 1;
5382 day4 =
date2j(year + 1, 1, 4);
5385 day0 =
j2day(day4 - 1);
5387 if (dayn >= day4 - day0)
5419 bool isNegative,
bool isTz)
5423 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
5424 errmsg(
"unit \"%s\" not recognized for type %s",
5463 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
5464 errmsg(
"unit \"%s\" not supported for type %s",
5528 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
5529 errmsg(
"timestamp out of range")));
5576 intresult = (
tm->
tm_mon - 1) / 3 + 1;
5601 intresult = -((8 - (
tm->
tm_year - 1)) / 10);
5616 intresult = -((99 - (
tm->
tm_year - 1)) / 100);
5624 intresult = -((999 - (
tm->
tm_year - 1)) / 1000);
5664 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
5665 errmsg(
"unit \"%s\" not supported for type %s",
5711 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
5712 errmsg(
"unit \"%s\" not supported for type %s",
5720 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
5721 errmsg(
"unit \"%s\" not recognized for type %s",
5802 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
5803 errmsg(
"timestamp out of range")));
5862 intresult = (
tm->
tm_mon - 1) / 3 + 1;
5882 intresult = -((8 - (
tm->
tm_year - 1)) / 10);
5890 intresult = -((99 - (
tm->
tm_year - 1)) / 100);
5898 intresult = -((999 - (
tm->
tm_year - 1)) / 1000);
5935 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
5936 errmsg(
"unit \"%s\" not supported for type %s",
5982 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
5983 errmsg(
"unit \"%s\" not supported for type %s",
5991 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
5992 errmsg(
"unit \"%s\" not recognized for type %s",
6032 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
6033 errmsg(
"unit \"%s\" not recognized for type %s",
6063 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
6064 errmsg(
"unit \"%s\" not supported for type %s",
6207 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
6208 errmsg(
"unit \"%s\" not supported for type %s",
6218 int64 secs_from_day_month;
6268 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
6269 errmsg(
"unit \"%s\" not recognized for type %s",
6336 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
6337 errmsg(
"timestamp out of range")));
6346 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
6347 errmsg(
"timestamp out of range")));
6351 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
6352 errmsg(
"timestamp out of range")));
6357 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
6358 errmsg(
"timestamp out of range")));
6379 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
6380 errmsg(
"interval time zone \"%s\" must be finite",
6384 if (
zone->month != 0 ||
zone->day != 0)
6386 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
6387 errmsg(
"interval time zone \"%s\" must not include months or days",
6397 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
6398 errmsg(
"timestamp out of range")));
6475 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
6476 errmsg(
"timestamp out of range")));
6544 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
6545 errmsg(
"timestamp out of range")));
6555 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
6556 errmsg(
"timestamp out of range")));
6610 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
6611 errmsg(
"timestamp out of range")));
6614 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
6615 errmsg(
"timestamp out of range")));
6620 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
6621 errmsg(
"timestamp out of range")));
6643 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
6644 errmsg(
"interval time zone \"%s\" must be finite",
6648 if (
zone->month != 0 ||
zone->day != 0)
6650 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
6651 errmsg(
"interval time zone \"%s\" must not include months or days",
6661 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
6662 errmsg(
"timestamp out of range")));
6709 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
6710 errmsg(
"step size cannot equal zero")));
6714 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
6715 errmsg(
"step size cannot be infinite")));
6794 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
6795 errmsg(
"step size cannot equal zero")));
6799 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
6800 errmsg(
"step size cannot be infinite")));
6910#define INTERVAL_TO_MICROSECONDS(i) ((((double) (i)->month * DAYS_PER_MONTH + (i)->day)) * USECS_PER_DAY + (i)->time)
6920 req->
rows = floor(ddiff / dstep + 1.0);
6923#undef INTERVAL_TO_MICROSECONDS
#define PG_GETARG_ARRAYTYPE_P(n)
int32 * ArrayGetIntegerTypmods(ArrayType *arr, int *n)
Node * TemporalSimplify(int32 max_precis, Node *node)
pg_tz * DecodeTimezoneNameToTz(const char *tzname)
int DetermineTimeZoneAbbrevOffsetTS(TimestampTz ts, const char *abbr, pg_tz *tzp, int *isdst)
int DecodeUnits(int field, const char *lowtoken, int *val)
int ParseDateTime(const char *timestr, char *workbuf, size_t buflen, char **field, int *ftype, int maxfields, int *numfields)
void EncodeInterval(struct pg_itm *itm, int style, char *str)
int DetermineTimeZoneOffset(struct pg_tm *tm, pg_tz *tzp)
void DateTimeParseError(int dterr, DateTimeErrorExtra *extra, const char *str, const char *datatype, Node *escontext)
int DecodeInterval(char **field, int *ftype, int nf, int range, int *dtype, struct pg_itm_in *itm_in)
int DecodeISO8601Interval(char *str, int *dtype, struct pg_itm_in *itm_in)
int ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc, struct pg_tm *tm)
int DecodeSpecial(int field, const char *lowtoken, int *val)
void j2date(int jd, int *year, int *month, int *day)
void EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str)
int DecodeTimezone(const char *str, int *tzp)
const char *const months[]
int DecodeDateTime(char **field, int *ftype, int nf, int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp, DateTimeErrorExtra *extra)
int date2j(int year, int month, int day)
int DecodeTimezoneName(const char *tzname, int *offset, pg_tz **tz)
int DetermineTimeZoneAbbrevOffset(struct pg_tm *tm, const char *abbr, pg_tz *tzp)
Datum numeric_round(PG_FUNCTION_ARGS)
Numeric int64_to_numeric(int64 val)
Numeric numeric_add_safe(Numeric num1, Numeric num2, Node *escontext)
Numeric int64_div_fast_to_numeric(int64 val1, int log10val2)
Numeric numeric_div_safe(Numeric num1, Numeric num2, Node *escontext)
Numeric numeric_sub_safe(Numeric num1, Numeric num2, Node *escontext)
Datum numeric_in(PG_FUNCTION_ARGS)
void dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec)
Datum interval_out(PG_FUNCTION_ARGS)
Datum interval_justify_hours(PG_FUNCTION_ARGS)
Datum make_timestamptz_at_timezone(PG_FUNCTION_ARGS)
int timestamp_cmp_internal(Timestamp dt1, Timestamp dt2)
long TimestampDifferenceMilliseconds(TimestampTz start_time, TimestampTz stop_time)
void isoweek2date(int woy, int *year, int *mon, int *mday)
Datum in_range_timestamp_interval(PG_FUNCTION_ARGS)
void GetEpochTime(struct pg_tm *tm)
Datum generate_series_timestamptz(PG_FUNCTION_ARGS)
static float8 NonFiniteTimestampTzPart(int type, int unit, char *lowunits, bool isNegative, bool isTz)
static INT128 interval_cmp_value(const Interval *interval)
Datum interval_trunc(PG_FUNCTION_ARGS)
Datum overlaps_timestamp(PG_FUNCTION_ARGS)
Datum extract_timestamp(PG_FUNCTION_ARGS)
Datum timestamptypmodout(PG_FUNCTION_ARGS)
Datum interval_gt(PG_FUNCTION_ARGS)
Datum interval_avg_accum(PG_FUNCTION_ARGS)
int itmin2interval(struct pg_itm_in *itm_in, Interval *span)
Datum interval_justify_interval(PG_FUNCTION_ARGS)
static void finite_interval_mi(const Interval *span1, const Interval *span2, Interval *result)
Datum timestamptz_part(PG_FUNCTION_ARGS)
int isoweek2j(int year, int week)
Datum clock_timestamp(PG_FUNCTION_ARGS)
Datum timestamptz_pl_interval_at_zone(PG_FUNCTION_ARGS)
Datum timestamp_pl_interval(PG_FUNCTION_ARGS)
Datum interval_le(PG_FUNCTION_ARGS)
Datum interval_avg_serialize(PG_FUNCTION_ARGS)
Datum interval_mi(PG_FUNCTION_ARGS)
TimestampTz time_t_to_timestamptz(pg_time_t tm)
Datum timestamp_le_timestamptz(PG_FUNCTION_ARGS)
Datum interval_lt(PG_FUNCTION_ARGS)
Datum timestamp_larger(PG_FUNCTION_ARGS)
static Datum timestamptz_part_common(PG_FUNCTION_ARGS, bool retnumeric)
Datum timestamptz_izone(PG_FUNCTION_ARGS)
Datum timestamp_cmp_timestamptz(PG_FUNCTION_ARGS)
static bool AdjustIntervalForTypmod(Interval *interval, int32 typmod, Node *escontext)
Datum timestamp_part(PG_FUNCTION_ARGS)
Datum timestamptz_eq_timestamp(PG_FUNCTION_ARGS)
Datum interval_hash(PG_FUNCTION_ARGS)
Datum timestamptztypmodout(PG_FUNCTION_ARGS)
int date2isoweek(int year, int mon, int mday)
Datum timestamptz_pl_interval(PG_FUNCTION_ARGS)
Datum timestamp_cmp(PG_FUNCTION_ARGS)
static TimestampTz timestamptz_trunc_internal(text *units, TimestampTz timestamp, pg_tz *tzp)
Datum timestamp_bin(PG_FUNCTION_ARGS)
Datum timestamp_zone(PG_FUNCTION_ARGS)
static pg_tz * lookup_timezone(text *zone)
static TimestampTz timestamp2timestamptz(Timestamp timestamp)
Datum interval_finite(PG_FUNCTION_ARGS)
Timestamp SetEpochTimestamp(void)
Datum timestamptz_ne_timestamp(PG_FUNCTION_ARGS)
Datum timestamptz_lt_timestamp(PG_FUNCTION_ARGS)
Datum timestamp_sortsupport(PG_FUNCTION_ARGS)
Datum timestamp_mi_interval(PG_FUNCTION_ARGS)
Datum timestamptypmodin(PG_FUNCTION_ARGS)
bool AdjustTimestampForTypmod(Timestamp *time, int32 typmod, Node *escontext)
Datum timestamptz_ge_timestamp(PG_FUNCTION_ARGS)
Datum timestamp_smaller(PG_FUNCTION_ARGS)
Datum interval_justify_days(PG_FUNCTION_ARGS)
TimestampTz timestamp2timestamptz_safe(Timestamp timestamp, Node *escontext)
Datum timestamp_ge(PG_FUNCTION_ARGS)
Datum interval_avg_accum_inv(PG_FUNCTION_ARGS)
Datum generate_series_timestamp(PG_FUNCTION_ARGS)
int date2isoyearday(int year, int mon, int mday)
int tm2timestamp(struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *result)
Datum timestamptz_cmp_timestamp(PG_FUNCTION_ARGS)
Datum timestamp_ge_timestamptz(PG_FUNCTION_ARGS)
static Timestamp timestamptz2timestamp(TimestampTz timestamp)
void TimestampDifference(TimestampTz start_time, TimestampTz stop_time, long *secs, int *microsecs)
static void do_interval_accum(IntervalAggState *state, Interval *newval)
Datum timestamp_scale(PG_FUNCTION_ARGS)
Datum timestamptz_scale(PG_FUNCTION_ARGS)
Datum make_timestamptz(PG_FUNCTION_ARGS)
bool TimestampDifferenceExceedsSeconds(TimestampTz start_time, TimestampTz stop_time, int threshold_sec)
bool TimestampTimestampTzRequiresRewrite(void)
Datum timestamp_timestamptz(PG_FUNCTION_ARGS)
Datum timestamp_recv(PG_FUNCTION_ARGS)
Datum timestamp_lt(PG_FUNCTION_ARGS)
Datum timestamptz_trunc(PG_FUNCTION_ARGS)
Datum timestamptz_zone(PG_FUNCTION_ARGS)
static void finite_interval_pl(const Interval *span1, const Interval *span2, Interval *result)
void isoweekdate2date(int isoweek, int wday, int *year, int *mon, int *mday)
int32 timestamp_cmp_timestamptz_internal(Timestamp timestampVal, TimestampTz dt2)
Datum timestamptz_gt_timestamp(PG_FUNCTION_ARGS)
Datum timestamptz_hash_extended(PG_FUNCTION_ARGS)
bool TimestampDifferenceExceeds(TimestampTz start_time, TimestampTz stop_time, int msec)
static int32 anytimestamp_typmodin(bool istz, ArrayType *ta)
Datum generate_series_timestamp_support(PG_FUNCTION_ARGS)
Datum interval_cmp(PG_FUNCTION_ARGS)
Datum interval_sum(PG_FUNCTION_ARGS)
Datum timestamp_hash_extended(PG_FUNCTION_ARGS)
Datum timestamptz_le_timestamp(PG_FUNCTION_ARGS)
Datum interval_pl(PG_FUNCTION_ARGS)
Datum interval_um(PG_FUNCTION_ARGS)
Datum timestamp_skipsupport(PG_FUNCTION_ARGS)
static float8 NonFiniteIntervalPart(int type, int unit, char *lowunits, bool isNegative)
void EncodeSpecialTimestamp(Timestamp dt, char *str)
Datum make_interval(PG_FUNCTION_ARGS)
static char * anytimestamp_typmodout(bool istz, int32 typmod)
Datum interval_ge(PG_FUNCTION_ARGS)
static Timestamp make_timestamp_internal(int year, int month, int day, int hour, int min, double sec)
Datum timestamp_gt_timestamptz(PG_FUNCTION_ARGS)
Datum timestamp_in(PG_FUNCTION_ARGS)
Datum timestamp_le(PG_FUNCTION_ARGS)
Datum interval_ne(PG_FUNCTION_ARGS)
Datum timestamptz_hash(PG_FUNCTION_ARGS)
Datum interval_in(PG_FUNCTION_ARGS)
static Timestamp dt2local(Timestamp dt, int timezone)
static Datum interval_part_common(PG_FUNCTION_ARGS, bool retnumeric)
Datum timestamp_ne_timestamptz(PG_FUNCTION_ARGS)
Datum interval_hash_extended(PG_FUNCTION_ARGS)
Datum timestamptz_mi_interval(PG_FUNCTION_ARGS)
Datum timestamp_age(PG_FUNCTION_ARGS)
Datum interval_smaller(PG_FUNCTION_ARGS)
static void EncodeSpecialInterval(const Interval *interval, char *str)
Datum timestamptz_mi_interval_at_zone(PG_FUNCTION_ARGS)
int timestamp2tm(Timestamp dt, int *tzp, struct pg_tm *tm, fsec_t *fsec, const char **tzn, pg_tz *attimezone)
Datum interval_support(PG_FUNCTION_ARGS)
Datum timestamptz_in(PG_FUNCTION_ARGS)
static int intervaltypmodleastfield(int32 typmod)
int32 anytimestamp_typmod_check(bool istz, int32 typmod)
Datum extract_timestamptz(PG_FUNCTION_ARGS)
Datum pg_postmaster_start_time(PG_FUNCTION_ARGS)
TimestampTz GetCurrentTimestamp(void)
static TimeOffset time2t(const int hour, const int min, const int sec, const fsec_t fsec)
Datum interval_part(PG_FUNCTION_ARGS)
Datum pg_conf_load_time(PG_FUNCTION_ARGS)
Datum in_range_interval_interval(PG_FUNCTION_ARGS)
#define IA_TOTAL_COUNT(ia)
const char * timestamptz_to_str(TimestampTz t)
Datum interval_eq(PG_FUNCTION_ARGS)
static Datum timestamp_increment(Relation rel, Datum existing, bool *overflow)
Timestamp GetSQLLocalTimestamp(int32 typmod)
Datum timestamp_finite(PG_FUNCTION_ARGS)
static TimestampTz timestamptz_mi_interval_internal(TimestampTz timestamp, Interval *span, pg_tz *attimezone)
Datum timestamp_trunc(PG_FUNCTION_ARGS)
Datum mul_d_interval(PG_FUNCTION_ARGS)
Datum timestamptztypmodin(PG_FUNCTION_ARGS)
Datum interval_avg(PG_FUNCTION_ARGS)
Datum timestamp_send(PG_FUNCTION_ARGS)
Datum timestamptz_send(PG_FUNCTION_ARGS)
Datum timestamptz_recv(PG_FUNCTION_ARGS)
Datum interval_scale(PG_FUNCTION_ARGS)
static Datum timestamp_part_common(PG_FUNCTION_ARGS, bool retnumeric)
Datum interval_larger(PG_FUNCTION_ARGS)
Datum timestamp_gt(PG_FUNCTION_ARGS)
static IntervalAggState * makeIntervalAggState(FunctionCallInfo fcinfo)
Datum timestamptz_bin(PG_FUNCTION_ARGS)
Datum timestamptz_timestamp(PG_FUNCTION_ARGS)
Datum timestamp_mi(PG_FUNCTION_ARGS)
Datum timestamptz_at_local(PG_FUNCTION_ARGS)
Datum interval_send(PG_FUNCTION_ARGS)
Datum intervaltypmodin(PG_FUNCTION_ARGS)
#define TIMESTAMP_GT(t1, t2)
Datum timestamp_lt_timestamptz(PG_FUNCTION_ARGS)
Datum timestamptz_out(PG_FUNCTION_ARGS)
static void interval_um_internal(const Interval *interval, Interval *result)
Datum timestamp_hash(PG_FUNCTION_ARGS)
Datum timestamp_out(PG_FUNCTION_ARGS)
Datum timestamp_support(PG_FUNCTION_ARGS)
void interval2itm(Interval span, struct pg_itm *itm)
Datum float8_timestamptz(PG_FUNCTION_ARGS)
Datum now(PG_FUNCTION_ARGS)
Datum interval_avg_deserialize(PG_FUNCTION_ARGS)
Datum timestamp_ne(PG_FUNCTION_ARGS)
static int interval_cmp_internal(const Interval *interval1, const Interval *interval2)
Datum interval_recv(PG_FUNCTION_ARGS)
#define INTERVAL_TO_MICROSECONDS(i)
Datum statement_timestamp(PG_FUNCTION_ARGS)
Datum timestamptz_age(PG_FUNCTION_ARGS)
Datum interval_mul(PG_FUNCTION_ARGS)
Datum interval_div(PG_FUNCTION_ARGS)
Datum timestamptz_trunc_zone(PG_FUNCTION_ARGS)
Datum timestamp_eq_timestamptz(PG_FUNCTION_ARGS)
static TimestampTz timestamptz_pl_interval_internal(TimestampTz timestamp, Interval *span, pg_tz *attimezone)
static Datum generate_series_timestamptz_internal(FunctionCallInfo fcinfo)
int itm2interval(struct pg_itm *itm, Interval *span)
pg_time_t timestamptz_to_time_t(TimestampTz t)
Datum make_timestamp(PG_FUNCTION_ARGS)
Datum intervaltypmodout(PG_FUNCTION_ARGS)
static int interval_sign(const Interval *interval)
static void do_interval_discard(IntervalAggState *state, Interval *newval)
Datum timeofday(PG_FUNCTION_ARGS)
Datum generate_series_timestamptz_at_zone(PG_FUNCTION_ARGS)
int date2isoyear(int year, int mon, int mday)
Timestamp timestamptz2timestamp_safe(TimestampTz timestamp, Node *escontext)
Datum timestamp_izone(PG_FUNCTION_ARGS)
static Datum timestamp_decrement(Relation rel, Datum existing, bool *underflow)
static int parse_sane_timezone(struct pg_tm *tm, text *zone)
Datum timestamp_at_local(PG_FUNCTION_ARGS)
TimestampTz GetSQLCurrentTimestamp(int32 typmod)
Datum in_range_timestamptz_interval(PG_FUNCTION_ARGS)
Datum interval_avg_combine(PG_FUNCTION_ARGS)
Datum extract_interval(PG_FUNCTION_ARGS)
Datum timestamp_eq(PG_FUNCTION_ARGS)
#define TIMESTAMP_LT(t1, t2)
#define FLOAT8_FITS_IN_INT32(num)
#define Assert(condition)
#define FLOAT8_FITS_IN_INT64(num)
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
Node * estimate_expression_value(PlannerInfo *root, Node *node)
#define DATETIME_MIN_JULIAN
#define INTERVAL_NOEND(i)
#define MAX_TIMESTAMP_PRECISION
#define INTERVAL_NOT_FINITE(i)
#define TIMESTAMP_NOBEGIN(j)
#define TIMESTAMP_END_JULIAN
#define IS_VALID_JULIAN(y, m, d)
#define INTERVAL_NOBEGIN(i)
#define INTERVAL_IS_NOBEGIN(i)
#define IS_VALID_TIMESTAMP(t)
#define MAX_INTERVAL_PRECISION
#define INTERVAL_IS_NOEND(i)
#define TIMESTAMP_IS_NOEND(j)
#define TIMESTAMP_IS_NOBEGIN(j)
#define TIMESTAMP_NOT_FINITE(j)
#define POSTGRES_EPOCH_JDATE
#define TIMESTAMP_NOEND(j)
bool float_time_overflows(int hour, int min, double sec)
int errcode(int sqlerrcode)
#define ereturn(context, dummy_value,...)
int errhint(const char *fmt,...) pg_attribute_printf(1
int errdetail(const char *fmt,...) pg_attribute_printf(1
#define ereport(elevel,...)
struct SortSupportData * SortSupport
#define palloc_object(type)
#define palloc0_object(type)
static float8 float8_mul(const float8 val1, const float8 val2)
static float8 get_float8_infinity(void)
#define PG_GETARG_BYTEA_PP(n)
#define PG_GETARG_TEXT_PP(n)
#define PG_RETURN_BYTEA_P(x)
#define DirectFunctionCall2(func, arg1, arg2)
#define PG_GETARG_FLOAT8(n)
#define PG_RETURN_FLOAT8(x)
#define PG_GETARG_POINTER(n)
#define PG_RETURN_CSTRING(x)
#define DirectFunctionCall1(func, arg1)
#define PG_GETARG_DATUM(n)
#define PG_GETARG_CSTRING(n)
#define PG_RETURN_TEXT_P(x)
#define PG_RETURN_INT32(x)
#define PG_GETARG_INT32(n)
#define PG_GETARG_BOOL(n)
#define DirectFunctionCall3(func, arg1, arg2, arg3)
#define PG_RETURN_POINTER(x)
#define PG_RETURN_BOOL(x)
#define SRF_IS_FIRSTCALL()
#define SRF_PERCALL_SETUP()
#define SRF_RETURN_NEXT(_funcctx, _result)
#define SRF_FIRSTCALL_INIT()
#define SRF_RETURN_DONE(_funcctx)
Datum hashint8extended(PG_FUNCTION_ARGS)
Datum hashint8(PG_FUNCTION_ARGS)
#define DTERR_INTERVAL_OVERFLOW
#define TZNAME_FIXED_OFFSET
#define DTERR_TZDISP_OVERFLOW
#define DTERR_FIELD_OVERFLOW
static int int128_compare(INT128 x, INT128 y)
static INT128 int64_to_int128(int64 v)
static int64 int128_to_int64(INT128 val)
static void int128_add_int64_mul_int64(INT128 *i128, int64 x, int64 y)
static bool pg_mul_s64_overflow(int64 a, int64 b, int64 *result)
static bool pg_sub_s64_overflow(int64 a, int64 b, int64 *result)
static bool pg_mul_s32_overflow(int32 a, int32 b, int32 *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)
char * pstrdup(const char *in)
#define SOFT_ERROR_OCCURRED(escontext)
int AggCheckCallContext(FunctionCallInfo fcinfo, MemoryContext *aggcontext)
int32 exprTypmod(const Node *expr)
Node * relabel_to_typmod(Node *expr, int32 typmod)
static bool is_funcclause(const void *clause)
#define IsA(nodeptr, _type_)
static Numeric DatumGetNumeric(Datum X)
#define PG_RETURN_NUMERIC(x)
static Datum NumericGetDatum(Numeric X)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
static int list_length(const List *l)
static rewind_source * source
static char buf[DEFAULT_XLOG_SEG_SIZE]
bool pg_get_timezone_offset(const pg_tz *tz, long int *gmtoff)
PGDLLIMPORT pg_tz * session_timezone
size_t pg_strftime(char *s, size_t maxsize, const char *format, const struct pg_tm *t)
struct pg_tm * pg_localtime(const pg_time_t *timep, const pg_tz *tz)
struct pg_tm * pg_gmtime(const pg_time_t *timep)
size_t strlcpy(char *dst, const char *src, size_t siz)
#define Int64GetDatumFast(X)
static Datum ObjectIdGetDatum(Oid X)
static char * DatumGetCString(Datum X)
static Datum Float8GetDatum(float8 X)
static Datum CStringGetDatum(const char *X)
static Datum Int32GetDatum(int32 X)
static int32 DatumGetInt32(Datum X)
#define PointerGetDatum(X)
char * psprintf(const char *fmt,...)
static struct cvec * range(struct vars *v, chr a, chr b, int cases)
char * downcase_truncate_identifier(const char *ident, int len, bool warn)
struct SkipSupportData * SkipSupport
struct StringInfoData * StringInfo
static void initReadOnlyStringInfo(StringInfo str, char *data, int len)
MemoryContext multi_call_memory_ctx
SkipSupportIncDec decrement
SkipSupportIncDec increment
int(* comparator)(Datum x, Datum y, SortSupport ssup)
int ssup_datum_signed_cmp(Datum x, Datum y, SortSupport ssup)
#define INTERVAL_FULL_RANGE
#define timestamptz_cmp_internal(dt1, dt2)
#define INTERVAL_PRECISION(t)
static Datum TimestampTzGetDatum(TimestampTz X)
#define INTERVAL_RANGE(t)
static Datum TimestampGetDatum(Timestamp X)
#define PG_GETARG_TIMESTAMP(n)
static Datum IntervalPGetDatum(const Interval *X)
#define PG_RETURN_TIMESTAMP(x)
#define PG_GETARG_INTERVAL_P(n)
#define PG_GETARG_TIMESTAMPTZ(n)
#define PG_RETURN_TIMESTAMPTZ(x)
static Interval * DatumGetIntervalP(Datum X)
#define PG_RETURN_INTERVAL_P(x)
#define INTERVAL_TYPMOD(p, r)
static Timestamp DatumGetTimestamp(Datum X)
#define INTERVAL_FULL_PRECISION
static Size VARSIZE_ANY_EXHDR(const void *PTR)
static char * VARDATA_ANY(const void *PTR)
text * cstring_to_text(const char *s)
void text_to_cstring_buffer(const text *src, char *dst, size_t dst_len)
static const unsigned __int64 epoch
int gettimeofday(struct timeval *tp, void *tzp)
TimestampTz GetCurrentStatementStartTimestamp(void)
TimestampTz GetCurrentTransactionStartTimestamp(void)