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 "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 1644 of file date.c.
References MAX_TIME_PRECISION.
Referenced by GetSQLCurrentTime(), GetSQLLocalTime(), parse_datetime(), time_in(), time_recv(), time_scale(), timetz_in(), timetz_recv(), and timetz_scale().
Definition at line 70 of file date.c.
References ereport, errcode(), errmsg(), ERROR, MAX_TIME_PRECISION, and WARNING.
Referenced by anytime_typmodin(), and transformSQLValueFunction().
Definition at line 49 of file date.c.
References anytime_typmod_check(), ArrayGetIntegerTypmods(), ereport, errcode(), errmsg(), and ERROR.
Referenced by timetypmodin(), and timetztypmodin().
Definition at line 92 of file date.c.
References psprintf(), and pstrdup().
Referenced by timetypmodout(), and timetztypmodout().
|
static |
Definition at line 607 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 719 of file date.c.
References DATE_IS_NOBEGIN, DATE_IS_NOEND, and USECS_PER_DAY.
Referenced by convert_timevalue_to_scalar().
Definition at line 563 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 703 of file date.c.
References date2timestamptz_opt_overflow().
Referenced by date_timestamptz().
TimestampTz date2timestamptz_opt_overflow | ( | DateADT | dateVal, |
int * | overflow | ||
) |
Definition at line 623 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 436 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 813 of file date.c.
References date_cmp_timestamp_internal(), PG_GETARG_DATEADT, PG_GETARG_TIMESTAMP, and PG_RETURN_INT32.
Definition at line 742 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 897 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 822 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 382 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 759 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 843 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 458 of file date.c.
References DATE_NOT_FINITE, PG_GETARG_DATEADT, and PG_RETURN_BOOL.
Datum date_ge | ( | PG_FUNCTION_ARGS | ) |
Definition at line 427 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 804 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 888 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 418 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 786 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 870 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 112 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, generate_unaccent_rules::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 409 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 795 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 879 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 400 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 777 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 861 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 486 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 1265 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 527 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 768 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 852 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 183 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.
Datum date_pl_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1245 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 503 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 208 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 230 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 449 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 1282 of file date.c.
References date2timestamp(), PG_GETARG_DATEADT, and PG_RETURN_TIMESTAMP.
Datum date_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1326 of file date.c.
References date2timestamptz(), PG_GETARG_DATEADT, and PG_RETURN_TIMESTAMP.
Datum datetime_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1965 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 2865 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 293 of file date.c.
References DATE_IS_NOBEGIN, DATE_IS_NOEND, EARLY, elog(), ERROR, LATE, and generate_unaccent_rules::str.
Referenced by date_out(), and JsonEncodeDateTime().
Datum extract_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1065 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 2240 of file date.c.
References time_part_common().
Datum extract_timetz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3029 of file date.c.
References timetz_part_common().
bool float_time_overflows | ( | int | hour, |
int | min, | ||
double | sec | ||
) |
Definition at line 1450 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 308 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 341 of file date.c.
References AdjustTimeForTypmod(), GetCurrentTimeUsec(), palloc(), TimeTzADT::time, tm, and tm2timetz().
Referenced by ExecEvalSQLValueFunction().
Definition at line 361 of file date.c.
References AdjustTimeForTypmod(), GetCurrentTimeUsec(), tm, and tm2time().
Referenced by ExecEvalSQLValueFunction().
Datum in_range_date_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1038 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 2091 of file date.c.
References ereport, errcode(), errmsg(), ERROR, 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 2631 of file date.c.
References ereport, errcode(), errmsg(), ERROR, 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 2011 of file date.c.
References days, PG_GETARG_INTERVAL_P, PG_RETURN_TIMEADT, Interval::time, and USECS_PER_DAY.
Datum make_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 244 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 1576 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 1782 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 2674 of file date.c.
References PG_ARGISNULL, PG_GETARG_DATUM, PG_RETURN_BOOL, PG_RETURN_NULL, TIMETZ_GT, and TIMETZ_LT.
Definition at line 1487 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 1733 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 1679 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 1724 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 1715 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 1373 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, generate_unaccent_rules::str, tm, and tm2time().
Datum time_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1988 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 1706 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 1697 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 2073 of file date.c.
References 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 2036 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 1500 of file date.c.
References buf, DateStyle, EncodeTimeOnly(), MAXDATELEN, PG_GETARG_TIMEADT, PG_RETURN_CSTRING, pstrdup(), time2tm(), and tm.
Definition at line 1426 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 2234 of file date.c.
References time_part_common().
|
static |
Definition at line 2131 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(), 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 2055 of file date.c.
References 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 1520 of file date.c.
References AdjustTimeForTypmod(), buf, ereport, errcode(), errmsg(), ERROR, 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 1624 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 1546 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 1604 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 2807 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().
Datum timestamp_cmp_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 960 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 1296 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.
Datum timestamp_eq_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 906 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 951 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 933 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 942 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 924 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 915 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 1904 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.
Datum timestamptz_cmp_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1023 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 1341 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.
Datum timestamptz_eq_date | ( | PG_FUNCTION_ARGS | ) |
Definition at line 969 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 1014 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 996 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 1005 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 987 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 978 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 1934 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.
Datum timestamptz_timetz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2833 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().
Datum timetypmodin | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1557 of file date.c.
References anytime_typmodin(), PG_GETARG_ARRAYTYPE_P, and PG_RETURN_INT32.
Datum timetypmodout | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1565 of file date.c.
References anytime_typmodout(), PG_GETARG_INT32, and PG_RETURN_CSTRING.
Definition at line 2394 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_cmp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2515 of file date.c.
References PG_GETARG_TIMETZADT_P, PG_RETURN_INT32, and timetz_cmp_internal().
Referenced by compareDatetime().
Definition at line 2434 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 2461 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 2506 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 2497 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 2524 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 2540 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 2264 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, generate_unaccent_rules::str, TimeTzADT::time, tm, and tm2timetz().
Datum timetz_izone | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3100 of file date.c.
References DatumGetCString(), DirectFunctionCall1, ereport, errcode(), errmsg(), ERROR, interval_out(), palloc(), PG_GETARG_INTERVAL_P, PG_GETARG_TIMETZADT_P, PG_RETURN_TIMETZADT_P, PointerGetDatum(), TimeTzADT::time, USECS_PER_DAY, USECS_PER_SEC, while(), and TimeTzADT::zone.
Datum timetz_larger | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2556 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 2488 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 2479 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 2609 of file date.c.
References 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 2470 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 2305 of file date.c.
References buf, DateStyle, EncodeTimeOnly(), MAXDATELEN, PG_GETARG_TIMETZADT_P, PG_RETURN_CSTRING, pstrdup(), timetz2tm(), and tm.
Datum timetz_part | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3023 of file date.c.
References timetz_part_common().
|
static |
Definition at line 2906 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(), 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 2587 of file date.c.
References 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 2326 of file date.c.
References AdjustTimeForTypmod(), buf, ereport, errcode(), errmsg(), ERROR, 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 2416 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 2362 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 2570 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 2794 of file date.c.
References PG_GETARG_TIMETZADT_P, PG_RETURN_TIMEADT, and TimeTzADT::time.
Datum timetz_zone | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3039 of file date.c.
References DecodeTimezoneName(), DetermineTimeZoneAbbrevOffsetTS(), ereport, errcode(), errmsg(), ERROR, GetCurrentTransactionStartTimestamp(), 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, while(), and TimeTzADT::zone.
Datum timetztypmodin | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2374 of file date.c.
References anytime_typmodin(), PG_GETARG_ARRAYTYPE_P, and PG_RETURN_INT32.
Datum timetztypmodout | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2382 of file date.c.
References anytime_typmodout(), PG_GETARG_INT32, and PG_RETURN_CSTRING.
Definition at line 1415 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 2254 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().