PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <ctype.h>
#include <limits.h>
#include <float.h>
#include <math.h>
#include <time.h>
#include "access/xact.h"
#include "catalog/pg_type.h"
#include "common/hashfn.h"
#include "common/int.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
#include "nodes/supportnodes.h"
#include "parser/scansup.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/date.h"
#include "utils/datetime.h"
#include "utils/numeric.h"
#include "utils/sortsupport.h"
Go to the source code of this file.
Macros | |
#define | TIMEADT_GT(t1, t2) (DatumGetTimeADT(t1) > DatumGetTimeADT(t2)) |
#define | TIMEADT_LT(t1, t2) (DatumGetTimeADT(t1) < DatumGetTimeADT(t2)) |
#define | TIMETZ_GT(t1, t2) DatumGetBool(DirectFunctionCall2(timetz_gt,t1,t2)) |
#define | TIMETZ_LT(t1, t2) DatumGetBool(DirectFunctionCall2(timetz_lt,t1,t2)) |
#define TIMEADT_GT | ( | t1, | |
t2 | |||
) | (DatumGetTimeADT(t1) > DatumGetTimeADT(t2)) |
#define TIMEADT_LT | ( | t1, | |
t2 | |||
) | (DatumGetTimeADT(t1) < DatumGetTimeADT(t2)) |
#define TIMETZ_GT | ( | t1, | |
t2 | |||
) | DatumGetBool(DirectFunctionCall2(timetz_gt,t1,t2)) |
#define TIMETZ_LT | ( | t1, | |
t2 | |||
) | DatumGetBool(DirectFunctionCall2(timetz_lt,t1,t2)) |
Definition at line 1657 of file date.c.
References INT64CONST, and MAX_TIME_PRECISION.
Referenced by executeDateTimeMethod(), GetSQLCurrentTime(), GetSQLLocalTime(), parse_datetime(), time_in(), time_recv(), time_scale(), timetz_in(), timetz_recv(), and timetz_scale().
Definition at line 71 of file date.c.
References ereport, errcode(), errmsg(), ERROR, MAX_TIME_PRECISION, and WARNING.
Referenced by anytime_typmodin(), executeDateTimeMethod(), and transformSQLValueFunction().
Definition at line 50 of file date.c.
References anytime_typmod_check(), ArrayGetIntegerTypmods(), ereport, errcode(), errmsg(), and ERROR.
Referenced by timetypmodin(), and timetztypmodin().
|
static |
Definition at line 93 of file date.c.
References psprintf(), and pstrdup().
Referenced by timetypmodout(), and timetztypmodout().
|
static |
Definition at line 620 of file date.c.
References date2timestamp_opt_overflow().
Referenced by date_mi_interval(), date_pl_interval(), date_timestamp(), datetime_timestamp(), and in_range_date_interval().
double date2timestamp_no_overflow | ( | DateADT | dateVal | ) |
Definition at line 732 of file date.c.
References DATE_IS_NOBEGIN, DATE_IS_NOEND, and USECS_PER_DAY.
Referenced by convert_timevalue_to_scalar().
Definition at line 576 of file date.c.
References DATE_IS_NOBEGIN, DATE_IS_NOEND, ereport, errcode(), errmsg(), ERROR, POSTGRES_EPOCH_JDATE, TIMESTAMP_END_JULIAN, TIMESTAMP_NOBEGIN, TIMESTAMP_NOEND, and USECS_PER_DAY.
Referenced by date2timestamp(), and date_cmp_timestamp_internal().
|
static |
Definition at line 716 of file date.c.
References date2timestamptz_opt_overflow().
Referenced by date_timestamptz().
TimestampTz date2timestamptz_opt_overflow | ( | DateADT | dateVal, |
int * | overflow | ||
) |
Definition at line 636 of file date.c.
References DATE_IS_NOBEGIN, DATE_IS_NOEND, DetermineTimeZoneOffset(), ereport, errcode(), errmsg(), ERROR, IS_VALID_TIMESTAMP, j2date(), MIN_TIMESTAMP, POSTGRES_EPOCH_JDATE, session_timezone, TIMESTAMP_END_JULIAN, TIMESTAMP_NOBEGIN, TIMESTAMP_NOEND, tm, pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, pg_tm::tm_year, USECS_PER_DAY, and USECS_PER_SEC.
Referenced by date2timestamptz(), and date_cmp_timestamptz_internal().
Datum date_cmp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 437 of file date.c.
References PG_GETARG_DATEADT, and PG_RETURN_INT32.
Referenced by compareDatetime(), and gbt_datekey_cmp().
Datum date_cmp_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 826 of file date.c.
References date_cmp_timestamp_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMP, and PG_RETURN_INT32.
Definition at line 755 of file date.c.
References Assert, date2timestamp_opt_overflow(), timestamp_cmp_internal(), and TIMESTAMP_IS_NOEND.
Referenced by cmpDateToTimestamp(), date_cmp_timestamp(), date_eq_timestamp(), date_ge_timestamp(), date_gt_timestamp(), date_le_timestamp(), date_lt_timestamp(), date_ne_timestamp(), timestamp_cmp_date(), timestamp_eq_date(), timestamp_ge_date(), timestamp_gt_date(), timestamp_le_date(), timestamp_lt_date(), and timestamp_ne_date().
Datum date_cmp_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 910 of file date.c.
References date_cmp_timestamptz_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMPTZ, and PG_RETURN_INT32.
int32 date_cmp_timestamptz_internal | ( | DateADT | dateVal, |
TimestampTz | dt2 | ||
) |
Definition at line 835 of file date.c.
References date2timestamptz_opt_overflow(), TIMESTAMP_IS_NOBEGIN, TIMESTAMP_IS_NOEND, and timestamptz_cmp_internal.
Referenced by cmpDateToTimestampTz(), date_cmp_timestamptz(), date_eq_timestamptz(), date_ge_timestamptz(), date_gt_timestamptz(), date_le_timestamptz(), date_lt_timestamptz(), date_ne_timestamptz(), timestamptz_cmp_date(), timestamptz_eq_date(), timestamptz_ge_date(), timestamptz_gt_date(), timestamptz_le_date(), timestamptz_lt_date(), and timestamptz_ne_date().
Datum date_eq | ( | PG_FUNCTION_ARGS | ) |
Definition at line 383 of file date.c.
References PG_GETARG_DATEADT, and PG_RETURN_BOOL.
Referenced by gbt_dateeq().
Datum date_eq_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 772 of file date.c.
References date_cmp_timestamp_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMP, and PG_RETURN_BOOL.
Datum date_eq_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 856 of file date.c.
References date_cmp_timestamptz_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMPTZ, and PG_RETURN_BOOL.
Datum date_finite | ( | PG_FUNCTION_ARGS | ) |
Definition at line 471 of file date.c.
References DATE_NOT_FINITE, PG_GETARG_DATEADT, and PG_RETURN_BOOL.
Datum date_ge | ( | PG_FUNCTION_ARGS | ) |
Definition at line 428 of file date.c.
References PG_GETARG_DATEADT, and PG_RETURN_BOOL.
Referenced by gbt_datege().
Datum date_ge_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 817 of file date.c.
References date_cmp_timestamp_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMP, and PG_RETURN_BOOL.
Datum date_ge_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 901 of file date.c.
References date_cmp_timestamptz_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMPTZ, and PG_RETURN_BOOL.
Datum date_gt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 419 of file date.c.
References PG_GETARG_DATEADT, and PG_RETURN_BOOL.
Referenced by gbt_dategt().
Datum date_gt_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 799 of file date.c.
References date_cmp_timestamp_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMP, and PG_RETURN_BOOL.
Datum date_gt_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 883 of file date.c.
References date_cmp_timestamptz_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMPTZ, and PG_RETURN_BOOL.
Datum date_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 113 of file date.c.
References date2j(), DATE_NOBEGIN, DATE_NOEND, DateTimeParseError(), DecodeDateTime(), DTERR_BAD_FORMAT, DTK_DATE, DTK_EARLY, DTK_EPOCH, DTK_LATE, ereturn, errcode(), errmsg(), GetEpochTime(), IS_VALID_DATE, IS_VALID_JULIAN, MAXDATEFIELDS, MAXDATELEN, ParseDateTime(), PG_GETARG_CSTRING, PG_RETURN_DATEADT, PG_RETURN_NULL, POSTGRES_EPOCH_JDATE, str, tm, pg_tm::tm_mday, pg_tm::tm_mon, and pg_tm::tm_year.
Datum date_larger | ( | PG_FUNCTION_ARGS | ) |
Datum date_le | ( | PG_FUNCTION_ARGS | ) |
Definition at line 410 of file date.c.
References PG_GETARG_DATEADT, and PG_RETURN_BOOL.
Referenced by gbt_datele().
Datum date_le_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 808 of file date.c.
References date_cmp_timestamp_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMP, and PG_RETURN_BOOL.
Datum date_le_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 892 of file date.c.
References date_cmp_timestamptz_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMPTZ, and PG_RETURN_BOOL.
Datum date_lt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 401 of file date.c.
References PG_GETARG_DATEADT, and PG_RETURN_BOOL.
Referenced by gbt_datelt().
Datum date_lt_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 790 of file date.c.
References date_cmp_timestamp_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMP, and PG_RETURN_BOOL.
Datum date_lt_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 874 of file date.c.
References date_cmp_timestamptz_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMPTZ, and PG_RETURN_BOOL.
Datum date_mi | ( | PG_FUNCTION_ARGS | ) |
Definition at line 499 of file date.c.
References DATE_NOT_FINITE, ereport, errcode(), errmsg(), ERROR, PG_GETARG_DATEADT, and PG_RETURN_INT32.
Referenced by date_dist(), gbt_date_penalty(), and gdb_date_dist().
Datum date_mi_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1278 of file date.c.
References date2timestamp(), DirectFunctionCall2, PG_GETARG_DATEADT, PG_GETARG_INTERVAL_P, PointerGetDatum(), timestamp_mi_interval(), and TimestampGetDatum().
Datum date_mii | ( | PG_FUNCTION_ARGS | ) |
Definition at line 540 of file date.c.
References DATE_NOT_FINITE, days, ereport, errcode(), errmsg(), ERROR, IS_VALID_DATE, PG_GETARG_DATEADT, PG_GETARG_INT32, and PG_RETURN_DATEADT.
Datum date_ne | ( | PG_FUNCTION_ARGS | ) |
Datum date_ne_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 781 of file date.c.
References date_cmp_timestamp_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMP, and PG_RETURN_BOOL.
Datum date_ne_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 865 of file date.c.
References date_cmp_timestamptz_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMPTZ, and PG_RETURN_BOOL.
Datum date_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 184 of file date.c.
References buf, DATE_NOT_FINITE, DateStyle, EncodeDateOnly(), EncodeSpecialDate(), j2date(), MAXDATELEN, PG_GETARG_DATEADT, PG_RETURN_CSTRING, POSTGRES_EPOCH_JDATE, pstrdup(), tm, pg_tm::tm_mday, pg_tm::tm_mon, and pg_tm::tm_year.
Referenced by ExecGetJsonValueItemString().
Datum date_pl_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1258 of file date.c.
References date2timestamp(), DirectFunctionCall2, PG_GETARG_DATEADT, PG_GETARG_INTERVAL_P, PointerGetDatum(), timestamp_pl_interval(), and TimestampGetDatum().
Datum date_pli | ( | PG_FUNCTION_ARGS | ) |
Definition at line 516 of file date.c.
References DATE_NOT_FINITE, days, ereport, errcode(), errmsg(), ERROR, IS_VALID_DATE, PG_GETARG_DATEADT, PG_GETARG_INT32, and PG_RETURN_DATEADT.
Datum date_recv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 209 of file date.c.
References buf, DATE_NOT_FINITE, ereport, errcode(), errmsg(), ERROR, IS_VALID_DATE, PG_GETARG_POINTER, PG_RETURN_DATEADT, and pq_getmsgint().
Datum date_send | ( | PG_FUNCTION_ARGS | ) |
Definition at line 231 of file date.c.
References buf, PG_GETARG_DATEADT, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), and pq_sendint32().
Datum date_smaller | ( | PG_FUNCTION_ARGS | ) |
Datum date_sortsupport | ( | PG_FUNCTION_ARGS | ) |
Definition at line 450 of file date.c.
References SortSupportData::comparator, PG_GETARG_POINTER, PG_RETURN_VOID, and ssup_datum_int32_cmp().
Datum date_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1295 of file date.c.
References date2timestamp(), PG_GETARG_DATEADT, and PG_RETURN_TIMESTAMP.
Referenced by executeDateTimeMethod().
Datum date_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1339 of file date.c.
References date2timestamptz(), PG_GETARG_DATEADT, and PG_RETURN_TIMESTAMP.
Referenced by executeDateTimeMethod().
Datum datetime_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1978 of file date.c.
References date2timestamp(), ereport, errcode(), errmsg(), ERROR, IS_VALID_TIMESTAMP, PG_GETARG_DATEADT, PG_GETARG_TIMEADT, PG_RETURN_TIMESTAMP, and TIMESTAMP_NOT_FINITE.
Datum datetimetz_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2898 of file date.c.
References DATE_IS_NOBEGIN, DATE_IS_NOEND, ereport, errcode(), errmsg(), ERROR, IS_VALID_TIMESTAMP, PG_GETARG_DATEADT, PG_GETARG_TIMETZADT_P, PG_RETURN_TIMESTAMP, POSTGRES_EPOCH_JDATE, TimeTzADT::time, TIMESTAMP_END_JULIAN, TIMESTAMP_NOBEGIN, TIMESTAMP_NOEND, USECS_PER_DAY, USECS_PER_SEC, and TimeTzADT::zone.
void EncodeSpecialDate | ( | DateADT | dt, |
char * | str | ||
) |
Definition at line 294 of file date.c.
References DATE_IS_NOBEGIN, DATE_IS_NOEND, EARLY, elog, ERROR, LATE, and str.
Referenced by date_out(), and JsonEncodeDateTime().
Datum extract_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1078 of file date.c.
References CStringGetDatum(), date2isoweek(), date2isoyear(), date2j(), DATE_IS_NOBEGIN, DATE_NOT_FINITE, DatumGetNumeric(), DecodeSpecial(), DecodeUnits(), DirectFunctionCall3, downcase_truncate_identifier(), DTK_CENTURY, DTK_DAY, DTK_DECADE, DTK_DOW, DTK_DOY, DTK_EPOCH, DTK_ISODOW, DTK_ISOYEAR, DTK_JULIAN, DTK_MILLENNIUM, DTK_MONTH, DTK_QUARTER, DTK_WEEK, DTK_YEAR, ereport, errcode(), errmsg(), ERROR, format_type_be(), Int32GetDatum(), int64_to_numeric(), InvalidOid, j2date(), j2day(), numeric_in(), ObjectIdGetDatum(), PG_GETARG_DATEADT, PG_GETARG_TEXT_PP, PG_RETURN_NULL, PG_RETURN_NUMERIC, POSTGRES_EPOCH_JDATE, RESERV, SECS_PER_DAY, type, UNITS, UNIX_EPOCH_JDATE, UNKNOWN_FIELD, val, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Datum extract_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2261 of file date.c.
References time_part_common().
Datum extract_timetz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3062 of file date.c.
References timetz_part_common().
bool float_time_overflows | ( | int | hour, |
int | min, | ||
double | sec | ||
) |
Definition at line 1463 of file date.c.
References HOURS_PER_DAY, MINS_PER_HOUR, SECS_PER_MINUTE, USECS_PER_DAY, and USECS_PER_SEC.
Referenced by make_time(), and make_timestamp_internal().
DateADT GetSQLCurrentDate | ( | void | ) |
Definition at line 309 of file date.c.
References date2j(), GetCurrentDateTime(), POSTGRES_EPOCH_JDATE, tm, pg_tm::tm_mday, pg_tm::tm_mon, and pg_tm::tm_year.
Referenced by ExecEvalSQLValueFunction().
Definition at line 342 of file date.c.
References AdjustTimeForTypmod(), GetCurrentTimeUsec(), palloc(), TimeTzADT::time, tm, and tm2timetz().
Referenced by ExecEvalSQLValueFunction().
Definition at line 362 of file date.c.
References AdjustTimeForTypmod(), GetCurrentTimeUsec(), tm, and tm2time().
Referenced by ExecEvalSQLValueFunction().
Datum hashdate | ( | PG_FUNCTION_ARGS | ) |
Datum hashdateextended | ( | PG_FUNCTION_ARGS | ) |
Definition at line 465 of file date.c.
References hash_uint32_extended(), PG_GETARG_DATEADT, and PG_GETARG_INT64.
Datum in_range_date_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1051 of file date.c.
References BoolGetDatum(), date2timestamp(), DirectFunctionCall5, in_range_timestamp_interval(), IntervalPGetDatum(), PG_GETARG_BOOL, PG_GETARG_DATEADT, PG_GETARG_INTERVAL_P, TimestampGetDatum(), and val.
Datum in_range_time_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2110 of file date.c.
References ereport, errcode(), errmsg(), ERROR, pg_add_s64_overflow(), PG_GETARG_BOOL, PG_GETARG_INTERVAL_P, PG_GETARG_TIMEADT, PG_RETURN_BOOL, Interval::time, and val.
Datum in_range_timetz_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2662 of file date.c.
References ereport, errcode(), errmsg(), ERROR, pg_add_s64_overflow(), PG_GETARG_BOOL, PG_GETARG_INTERVAL_P, PG_GETARG_TIMETZADT_P, PG_RETURN_BOOL, Interval::time, TimeTzADT::time, timetz_cmp_internal(), val, and TimeTzADT::zone.
Datum interval_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2024 of file date.c.
References ereport, errcode(), errmsg(), ERROR, INTERVAL_NOT_FINITE, PG_GETARG_INTERVAL_P, PG_RETURN_TIMEADT, Interval::time, and USECS_PER_DAY.
Datum make_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 245 of file date.c.
References date2j(), DTK_DATE_M, ereport, errcode(), errmsg(), ERROR, IS_VALID_DATE, IS_VALID_JULIAN, PG_GETARG_INT32, PG_RETURN_DATEADT, POSTGRES_EPOCH_JDATE, tm, pg_tm::tm_mday, pg_tm::tm_mon, pg_tm::tm_year, and ValidateDate().
Datum make_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1589 of file date.c.
References ereport, errcode(), errmsg(), ERROR, float_time_overflows(), MINS_PER_HOUR, PG_GETARG_FLOAT8, PG_GETARG_INT32, PG_RETURN_TIMEADT, SECS_PER_MINUTE, pg_tm::tm_hour, pg_tm::tm_min, and USECS_PER_SEC.
Datum overlaps_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1795 of file date.c.
References PG_ARGISNULL, PG_GETARG_DATUM, PG_RETURN_BOOL, PG_RETURN_NULL, TIMEADT_GT, and TIMEADT_LT.
Datum overlaps_timetz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2707 of file date.c.
References PG_ARGISNULL, PG_GETARG_DATUM, PG_RETURN_BOOL, PG_RETURN_NULL, TIMETZ_GT, and TIMETZ_LT.
Definition at line 1500 of file date.c.
References tm, pg_tm::tm_hour, pg_tm::tm_min, pg_tm::tm_sec, USECS_PER_HOUR, USECS_PER_MINUTE, and USECS_PER_SEC.
Referenced by JsonEncodeDateTime(), time_out(), time_part_common(), and time_timetz().
Datum time_cmp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1746 of file date.c.
References PG_GETARG_TIMEADT, and PG_RETURN_INT32.
Referenced by compareDatetime(), and gbt_timekey_cmp().
Datum time_eq | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1692 of file date.c.
References PG_GETARG_TIMEADT, and PG_RETURN_BOOL.
Referenced by gbt_timeeq().
Datum time_ge | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1737 of file date.c.
References PG_GETARG_TIMEADT, and PG_RETURN_BOOL.
Referenced by gbt_timege().
Datum time_gt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1728 of file date.c.
References PG_GETARG_TIMEADT, and PG_RETURN_BOOL.
Referenced by gbt_timegt().
Datum time_hash | ( | PG_FUNCTION_ARGS | ) |
Datum time_hash_extended | ( | PG_FUNCTION_ARGS | ) |
Datum time_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1386 of file date.c.
References AdjustTimeForTypmod(), DateTimeParseError(), DecodeTimeOnly(), MAXDATEFIELDS, MAXDATELEN, ParseDateTime(), PG_GETARG_CSTRING, PG_GETARG_INT32, PG_GETARG_OID, PG_RETURN_NULL, PG_RETURN_TIMEADT, str, tm, and tm2time().
Datum time_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2001 of file date.c.
References Interval::day, Interval::month, palloc(), PG_GETARG_TIMEADT, PG_RETURN_INTERVAL_P, and Interval::time.
Datum time_larger | ( | PG_FUNCTION_ARGS | ) |
Datum time_le | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1719 of file date.c.
References PG_GETARG_TIMEADT, and PG_RETURN_BOOL.
Referenced by gbt_timele().
Datum time_lt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1710 of file date.c.
References PG_GETARG_TIMEADT, and PG_RETURN_BOOL.
Referenced by gbt_timelt().
Datum time_mi_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2087 of file date.c.
References ereport, errcode(), errmsg(), ERROR, INT64CONST, INTERVAL_NOT_FINITE, PG_GETARG_INTERVAL_P, PG_GETARG_TIMEADT, PG_RETURN_TIMEADT, Interval::time, and USECS_PER_DAY.
Datum time_mi_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2045 of file date.c.
References Interval::day, Interval::month, palloc(), PG_GETARG_TIMEADT, PG_RETURN_INTERVAL_P, and Interval::time.
Referenced by gbt_time_dist(), gbt_time_penalty(), and time_dist().
Datum time_ne | ( | PG_FUNCTION_ARGS | ) |
Datum time_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1513 of file date.c.
References buf, DateStyle, EncodeTimeOnly(), MAXDATELEN, PG_GETARG_TIMEADT, PG_RETURN_CSTRING, pstrdup(), time2tm(), and tm.
Referenced by ExecGetJsonValueItemString().
bool time_overflows | ( | int | hour, |
int | min, | ||
int | sec, | ||
fsec_t | fsec | ||
) |
Definition at line 1439 of file date.c.
References HOURS_PER_DAY, MINS_PER_HOUR, SECS_PER_MINUTE, USECS_PER_DAY, and USECS_PER_SEC.
Referenced by DecodeDateTime(), and DecodeTimeOnly().
Datum time_part | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2255 of file date.c.
References time_part_common().
|
static |
Definition at line 2152 of file date.c.
References DecodeSpecial(), DecodeUnits(), downcase_truncate_identifier(), DTK_CENTURY, DTK_DAY, DTK_DECADE, DTK_EPOCH, DTK_HOUR, DTK_ISOYEAR, DTK_MICROSEC, DTK_MILLENNIUM, DTK_MILLISEC, DTK_MINUTE, DTK_MONTH, DTK_QUARTER, DTK_SECOND, DTK_TZ, DTK_TZ_HOUR, DTK_TZ_MINUTE, DTK_YEAR, ereport, errcode(), errmsg(), ERROR, format_type_be(), int64_div_fast_to_numeric(), int64_to_numeric(), INT64CONST, PG_GETARG_TEXT_PP, PG_GETARG_TIMEADT, PG_RETURN_FLOAT8, PG_RETURN_NUMERIC, RESERV, time2tm(), tm, pg_tm::tm_hour, pg_tm::tm_min, pg_tm::tm_sec, type, UNITS, UNKNOWN_FIELD, val, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Referenced by extract_time(), and time_part().
Datum time_pl_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2064 of file date.c.
References ereport, errcode(), errmsg(), ERROR, INT64CONST, INTERVAL_NOT_FINITE, PG_GETARG_INTERVAL_P, PG_GETARG_TIMEADT, PG_RETURN_TIMEADT, Interval::time, and USECS_PER_DAY.
Datum time_recv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1533 of file date.c.
References AdjustTimeForTypmod(), buf, ereport, errcode(), errmsg(), ERROR, INT64CONST, PG_GETARG_INT32, PG_GETARG_OID, PG_GETARG_POINTER, PG_RETURN_TIMEADT, pq_getmsgint64(), and USECS_PER_DAY.
Datum time_scale | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1637 of file date.c.
References AdjustTimeForTypmod(), PG_GETARG_INT32, PG_GETARG_TIMEADT, and PG_RETURN_TIMEADT.
Datum time_send | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1559 of file date.c.
References buf, PG_GETARG_TIMEADT, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), and pq_sendint64().
Datum time_smaller | ( | PG_FUNCTION_ARGS | ) |
Datum time_support | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1617 of file date.c.
References SupportRequestSimplify::fcall, IsA, MAX_TIME_PRECISION, PG_GETARG_POINTER, PG_RETURN_POINTER, and TemporalSimplify().
Datum time_timetz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2840 of file date.c.
References DetermineTimeZoneOffset(), GetCurrentDateTime(), palloc(), PG_GETARG_TIMEADT, PG_RETURN_TIMETZADT_P, session_timezone, TimeTzADT::time, time2tm(), tm, and TimeTzADT::zone.
Referenced by castTimeToTimeTz(), and executeDateTimeMethod().
Datum timestamp_cmp_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 973 of file date.c.
References date_cmp_timestamp_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMP, and PG_RETURN_INT32.
Datum timestamp_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1309 of file date.c.
References date2j(), DATE_NOBEGIN, DATE_NOEND, ereport, errcode(), errmsg(), ERROR, PG_GETARG_TIMESTAMP, PG_RETURN_DATEADT, POSTGRES_EPOCH_JDATE, timestamp2tm(), TIMESTAMP_IS_NOBEGIN, TIMESTAMP_IS_NOEND, tm, pg_tm::tm_mday, pg_tm::tm_mon, and pg_tm::tm_year.
Referenced by executeDateTimeMethod().
Datum timestamp_eq_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 919 of file date.c.
References date_cmp_timestamp_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMP, and PG_RETURN_BOOL.
Datum timestamp_ge_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 964 of file date.c.
References date_cmp_timestamp_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMP, and PG_RETURN_BOOL.
Datum timestamp_gt_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 946 of file date.c.
References date_cmp_timestamp_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMP, and PG_RETURN_BOOL.
Datum timestamp_le_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 955 of file date.c.
References date_cmp_timestamp_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMP, and PG_RETURN_BOOL.
Datum timestamp_lt_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 937 of file date.c.
References date_cmp_timestamp_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMP, and PG_RETURN_BOOL.
Datum timestamp_ne_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 928 of file date.c.
References date_cmp_timestamp_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMP, and PG_RETURN_BOOL.
Datum timestamp_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1917 of file date.c.
References ereport, errcode(), errmsg(), ERROR, MINS_PER_HOUR, PG_GETARG_TIMESTAMP, PG_RETURN_NULL, PG_RETURN_TIMEADT, SECS_PER_MINUTE, timestamp2tm(), TIMESTAMP_NOT_FINITE, tm, pg_tm::tm_hour, pg_tm::tm_min, pg_tm::tm_sec, and USECS_PER_SEC.
Referenced by executeDateTimeMethod().
Datum timestamptz_cmp_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1036 of file date.c.
References date_cmp_timestamptz_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMPTZ, and PG_RETURN_INT32.
Datum timestamptz_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1354 of file date.c.
References date2j(), DATE_NOBEGIN, DATE_NOEND, ereport, errcode(), errmsg(), ERROR, PG_GETARG_TIMESTAMP, PG_RETURN_DATEADT, POSTGRES_EPOCH_JDATE, timestamp2tm(), TIMESTAMP_IS_NOBEGIN, TIMESTAMP_IS_NOEND, tm, pg_tm::tm_mday, pg_tm::tm_mon, and pg_tm::tm_year.
Referenced by executeDateTimeMethod().
Datum timestamptz_eq_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 982 of file date.c.
References date_cmp_timestamptz_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMPTZ, and PG_RETURN_BOOL.
Datum timestamptz_ge_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1027 of file date.c.
References date_cmp_timestamptz_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMPTZ, and PG_RETURN_BOOL.
Datum timestamptz_gt_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1009 of file date.c.
References date_cmp_timestamptz_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMPTZ, and PG_RETURN_BOOL.
Datum timestamptz_le_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1018 of file date.c.
References date_cmp_timestamptz_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMPTZ, and PG_RETURN_BOOL.
Datum timestamptz_lt_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1000 of file date.c.
References date_cmp_timestamptz_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMPTZ, and PG_RETURN_BOOL.
Datum timestamptz_ne_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 991 of file date.c.
References date_cmp_timestamptz_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMPTZ, and PG_RETURN_BOOL.
Datum timestamptz_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1947 of file date.c.
References ereport, errcode(), errmsg(), ERROR, MINS_PER_HOUR, PG_GETARG_TIMESTAMP, PG_RETURN_NULL, PG_RETURN_TIMEADT, SECS_PER_MINUTE, timestamp2tm(), TIMESTAMP_NOT_FINITE, tm, pg_tm::tm_hour, pg_tm::tm_min, pg_tm::tm_sec, and USECS_PER_SEC.
Referenced by executeDateTimeMethod().
Datum timestamptz_timetz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2866 of file date.c.
References ereport, errcode(), errmsg(), ERROR, palloc(), PG_GETARG_TIMESTAMP, PG_RETURN_NULL, PG_RETURN_TIMETZADT_P, timestamp2tm(), TIMESTAMP_NOT_FINITE, tm, and tm2timetz().
Referenced by executeDateTimeMethod().
Datum timetypmodin | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1570 of file date.c.
References anytime_typmodin(), PG_GETARG_ARRAYTYPE_P, and PG_RETURN_INT32.
Datum timetypmodout | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1578 of file date.c.
References anytime_typmodout(), PG_GETARG_INT32, and PG_RETURN_CSTRING.
Definition at line 2415 of file date.c.
References TimeTzADT::time, tm, pg_tm::tm_hour, pg_tm::tm_min, pg_tm::tm_sec, USECS_PER_HOUR, USECS_PER_MINUTE, USECS_PER_SEC, and TimeTzADT::zone.
Referenced by JsonEncodeDateTime(), timetz_out(), and timetz_part_common().
Datum timetz_at_local | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3177 of file date.c.
References cstring_to_text(), DirectFunctionCall2, pg_get_timezone_name(), PG_GETARG_DATUM, PointerGetDatum(), session_timezone, and timetz_zone().
Datum timetz_cmp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2536 of file date.c.
References PG_GETARG_TIMETZADT_P, PG_RETURN_INT32, and timetz_cmp_internal().
Referenced by compareDatetime().
Definition at line 2455 of file date.c.
References TimeTzADT::time, USECS_PER_SEC, and TimeTzADT::zone.
Referenced by in_range_timetz_interval(), timetz_cmp(), timetz_eq(), timetz_ge(), timetz_gt(), timetz_larger(), timetz_le(), timetz_lt(), timetz_ne(), and timetz_smaller().
Datum timetz_eq | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2482 of file date.c.
References PG_GETARG_TIMETZADT_P, PG_RETURN_BOOL, and timetz_cmp_internal().
Datum timetz_ge | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2527 of file date.c.
References PG_GETARG_TIMETZADT_P, PG_RETURN_BOOL, and timetz_cmp_internal().
Datum timetz_gt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2518 of file date.c.
References PG_GETARG_TIMETZADT_P, PG_RETURN_BOOL, and timetz_cmp_internal().
Datum timetz_hash | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2545 of file date.c.
References DatumGetUInt32(), DirectFunctionCall1, hash_uint32(), hashint8(), Int64GetDatumFast, sort-test::key, PG_GETARG_TIMETZADT_P, and PG_RETURN_UINT32.
Datum timetz_hash_extended | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2561 of file date.c.
References DatumGetInt64(), DatumGetUInt64(), DirectFunctionCall2, hash_uint32_extended(), hashint8extended(), Int64GetDatumFast, sort-test::key, PG_GETARG_DATUM, PG_GETARG_TIMETZADT_P, and PG_RETURN_UINT64.
Datum timetz_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2285 of file date.c.
References AdjustTimeForTypmod(), DateTimeParseError(), DecodeTimeOnly(), MAXDATEFIELDS, MAXDATELEN, palloc(), ParseDateTime(), PG_GETARG_CSTRING, PG_GETARG_INT32, PG_GETARG_OID, PG_RETURN_NULL, PG_RETURN_TIMETZADT_P, str, TimeTzADT::time, tm, and tm2timetz().
Datum timetz_izone | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3134 of file date.c.
References DatumGetCString(), DirectFunctionCall1, ereport, errcode(), errmsg(), ERROR, if(), INT64CONST, INTERVAL_NOT_FINITE, interval_out(), palloc(), PG_GETARG_INTERVAL_P, PG_GETARG_TIMETZADT_P, PG_RETURN_TIMETZADT_P, PointerGetDatum(), TimeTzADT::time, USECS_PER_DAY, USECS_PER_SEC, and TimeTzADT::zone.
Datum timetz_larger | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2577 of file date.c.
References PG_GETARG_TIMETZADT_P, PG_RETURN_TIMETZADT_P, and timetz_cmp_internal().
Datum timetz_le | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2509 of file date.c.
References PG_GETARG_TIMETZADT_P, PG_RETURN_BOOL, and timetz_cmp_internal().
Datum timetz_lt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2500 of file date.c.
References PG_GETARG_TIMETZADT_P, PG_RETURN_BOOL, and timetz_cmp_internal().
Datum timetz_mi_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2635 of file date.c.
References ereport, errcode(), errmsg(), ERROR, INT64CONST, INTERVAL_NOT_FINITE, palloc(), PG_GETARG_INTERVAL_P, PG_GETARG_TIMETZADT_P, PG_RETURN_TIMETZADT_P, Interval::time, TimeTzADT::time, USECS_PER_DAY, and TimeTzADT::zone.
Datum timetz_ne | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2491 of file date.c.
References PG_GETARG_TIMETZADT_P, PG_RETURN_BOOL, and timetz_cmp_internal().
Datum timetz_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2326 of file date.c.
References buf, DateStyle, EncodeTimeOnly(), MAXDATELEN, PG_GETARG_TIMETZADT_P, PG_RETURN_CSTRING, pstrdup(), timetz2tm(), and tm.
Referenced by ExecGetJsonValueItemString().
Datum timetz_part | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3056 of file date.c.
References timetz_part_common().
|
static |
Definition at line 2939 of file date.c.
References DecodeSpecial(), DecodeUnits(), downcase_truncate_identifier(), DTK_CENTURY, DTK_DAY, DTK_DECADE, DTK_EPOCH, DTK_HOUR, DTK_MICROSEC, DTK_MILLENNIUM, DTK_MILLISEC, DTK_MINUTE, DTK_MONTH, DTK_QUARTER, DTK_SECOND, DTK_TZ, DTK_TZ_HOUR, DTK_TZ_MINUTE, DTK_YEAR, ereport, errcode(), errmsg(), ERROR, format_type_be(), int64_div_fast_to_numeric(), int64_to_numeric(), INT64CONST, MINS_PER_HOUR, PG_GETARG_TEXT_PP, PG_GETARG_TIMETZADT_P, PG_RETURN_FLOAT8, PG_RETURN_NUMERIC, RESERV, SECS_PER_HOUR, SECS_PER_MINUTE, TimeTzADT::time, timetz2tm(), tm, pg_tm::tm_hour, pg_tm::tm_min, pg_tm::tm_sec, type, UNITS, UNKNOWN_FIELD, val, VARDATA_ANY, VARSIZE_ANY_EXHDR, and TimeTzADT::zone.
Referenced by extract_timetz(), and timetz_part().
Datum timetz_pl_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2608 of file date.c.
References ereport, errcode(), errmsg(), ERROR, INT64CONST, INTERVAL_NOT_FINITE, palloc(), PG_GETARG_INTERVAL_P, PG_GETARG_TIMETZADT_P, PG_RETURN_TIMETZADT_P, Interval::time, TimeTzADT::time, USECS_PER_DAY, and TimeTzADT::zone.
Datum timetz_recv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2347 of file date.c.
References AdjustTimeForTypmod(), buf, ereport, errcode(), errmsg(), ERROR, INT64CONST, palloc(), PG_GETARG_INT32, PG_GETARG_OID, PG_GETARG_POINTER, PG_RETURN_TIMETZADT_P, pq_getmsgint(), pq_getmsgint64(), TimeTzADT::time, TZDISP_LIMIT, USECS_PER_DAY, and TimeTzADT::zone.
Datum timetz_scale | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2437 of file date.c.
References AdjustTimeForTypmod(), palloc(), PG_GETARG_INT32, PG_GETARG_TIMETZADT_P, PG_RETURN_TIMETZADT_P, TimeTzADT::time, and TimeTzADT::zone.
Datum timetz_send | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2383 of file date.c.
References buf, PG_GETARG_TIMETZADT_P, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendint32(), pq_sendint64(), TimeTzADT::time, and TimeTzADT::zone.
Datum timetz_smaller | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2591 of file date.c.
References PG_GETARG_TIMETZADT_P, PG_RETURN_TIMETZADT_P, and timetz_cmp_internal().
Datum timetz_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2827 of file date.c.
References PG_GETARG_TIMETZADT_P, PG_RETURN_TIMEADT, and TimeTzADT::time.
Referenced by executeDateTimeMethod().
Datum timetz_zone | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3072 of file date.c.
References DecodeTimezoneName(), DetermineTimeZoneAbbrevOffsetTS(), ereport, errcode(), errmsg(), ERROR, GetCurrentTransactionStartTimestamp(), if(), INT64CONST, now(), palloc(), PG_GETARG_TEXT_PP, PG_GETARG_TIMETZADT_P, PG_RETURN_TIMETZADT_P, text_to_cstring_buffer(), TimeTzADT::time, timestamp2tm(), tm, type, TZ_STRLEN_MAX, TZNAME_DYNTZ, TZNAME_FIXED_OFFSET, USECS_PER_DAY, USECS_PER_SEC, val, and TimeTzADT::zone.
Referenced by timetz_at_local().
Datum timetztypmodin | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2395 of file date.c.
References anytime_typmodin(), PG_GETARG_ARRAYTYPE_P, and PG_RETURN_INT32.
Datum timetztypmodout | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2403 of file date.c.
References anytime_typmodout(), PG_GETARG_INT32, and PG_RETURN_CSTRING.
Definition at line 1428 of file date.c.
References MINS_PER_HOUR, SECS_PER_MINUTE, tm, pg_tm::tm_hour, pg_tm::tm_min, pg_tm::tm_sec, and USECS_PER_SEC.
Referenced by GetSQLLocalTime(), parse_datetime(), and time_in().
Definition at line 2275 of file date.c.
References MINS_PER_HOUR, SECS_PER_MINUTE, TimeTzADT::time, tm, pg_tm::tm_hour, pg_tm::tm_min, pg_tm::tm_sec, USECS_PER_SEC, and TimeTzADT::zone.
Referenced by GetSQLCurrentTime(), parse_datetime(), timestamptz_timetz(), and timetz_in().