|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <ctype.h>#include <math.h>#include <limits.h>#include <sys/time.h>#include "access/xact.h"#include "catalog/pg_type.h"#include "common/int.h"#include "common/int128.h"#include "funcapi.h"#include "libpq/pqformat.h"#include "miscadmin.h"#include "nodes/nodeFuncs.h"#include "nodes/supportnodes.h"#include "optimizer/optimizer.h"#include "parser/scansup.h"#include "utils/array.h"#include "utils/builtins.h"#include "utils/date.h"#include "utils/datetime.h"#include "utils/float.h"#include "utils/numeric.h"#include "utils/skipsupport.h"#include "utils/sortsupport.h"
Go to the source code of this file.
Data Structures | |
| struct | generate_series_timestamp_fctx |
| struct | generate_series_timestamptz_fctx |
| struct | IntervalAggState |
Macros | |
| #define | IA_TOTAL_COUNT(ia) ((ia)->N + (ia)->pInfcount + (ia)->nInfcount) |
| #define | TIMESTAMP_GT(t1, t2) DatumGetBool(DirectFunctionCall2(timestamp_gt,t1,t2)) |
| #define | TIMESTAMP_LT(t1, t2) DatumGetBool(DirectFunctionCall2(timestamp_lt,t1,t2)) |
| #define | INTERVAL_TO_MICROSECONDS(i) ((((double) (i)->month * DAYS_PER_MONTH + (i)->day)) * USECS_PER_DAY + (i)->time) |
Typedefs | |
| typedef struct IntervalAggState | IntervalAggState |
Variables | |
| TimestampTz | PgStartTime |
| TimestampTz | PgReloadTime |
Definition at line 80 of file timestamp.c.
| #define INTERVAL_TO_MICROSECONDS | ( | i | ) | ((((double) (i)->month * DAYS_PER_MONTH + (i)->day)) * USECS_PER_DAY + (i)->time) |
| #define TIMESTAMP_GT | ( | t1, | |
| t2 | |||
| ) | DatumGetBool(DirectFunctionCall2(timestamp_gt,t1,t2)) |
| #define TIMESTAMP_LT | ( | t1, | |
| t2 | |||
| ) | DatumGetBool(DirectFunctionCall2(timestamp_lt,t1,t2)) |
Definition at line 1353 of file timestamp.c.
References DAY, elog, ereturn, errcode(), errmsg, ERROR, fb(), HOUR, INT64CONST, INTERVAL_FULL_PRECISION, INTERVAL_FULL_RANGE, INTERVAL_MASK, INTERVAL_NOT_FINITE, INTERVAL_PRECISION, INTERVAL_RANGE, MAX_INTERVAL_PRECISION, MINUTE, MONTH, interval::month, MONTHS_PER_YEAR, pg_add_s64_overflow(), pg_sub_s64_overflow(), range(), SECOND, interval::time, USECS_PER_HOUR, USECS_PER_MINUTE, and YEAR.
Referenced by interval_in(), interval_recv(), and interval_scale().
Definition at line 363 of file timestamp.c.
References ereturn, errcode(), errmsg, fb(), INT64CONST, MAX_TIMESTAMP_PRECISION, and TIMESTAMP_NOT_FINITE.
Referenced by executeDateTimeMethod(), GetSQLCurrentTimestamp(), GetSQLLocalTimestamp(), parse_datetime(), timestamp_in(), timestamp_recv(), timestamp_scale(), timestamptz_in(), timestamptz_recv(), timestamptz_scale(), and to_timestamp().
Definition at line 116 of file timestamp.c.
References ereport, errcode(), errmsg, ERROR, fb(), MAX_TIMESTAMP_PRECISION, and WARNING.
Referenced by anytimestamp_typmodin(), executeDateTimeMethod(), and transformSQLValueFunction().
Definition at line 95 of file timestamp.c.
References anytimestamp_typmod_check(), ArrayGetIntegerTypmods(), ereport, errcode(), errmsg, ERROR, and fb().
Referenced by timestamptypmodin(), and timestamptztypmodin().
Definition at line 138 of file timestamp.c.
References fb(), psprintf(), and pstrdup().
Referenced by timestamptypmodout(), and timestamptztypmodout().
| Datum clock_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1625 of file timestamp.c.
References GetCurrentTimestamp(), and PG_RETURN_TIMESTAMPTZ.
Definition at line 5326 of file timestamp.c.
References date2j(), fb(), and j2day().
Referenced by DCH_to_char(), extract_date(), timestamp_part_common(), timestamp_trunc(), timestamptz_part_common(), and timestamptz_trunc_internal().
Definition at line 5382 of file timestamp.c.
References date2j(), fb(), and j2day().
Referenced by date2isoyearday(), DCH_to_char(), extract_date(), timestamp_part_common(), and timestamptz_part_common().
Definition at line 5440 of file timestamp.c.
References date2isoyear(), date2j(), fb(), and isoweek2j().
Referenced by DCH_to_char().
|
static |
Definition at line 4008 of file timestamp.c.
References finite_interval_pl(), INTERVAL_IS_NOBEGIN, INTERVAL_IS_NOEND, and newval.
Referenced by interval_avg_accum().
|
static |
Definition at line 4031 of file timestamp.c.
References Assert, fb(), finite_interval_mi(), INTERVAL_IS_NOBEGIN, INTERVAL_IS_NOEND, and newval.
Referenced by interval_avg_accum_inv().
Definition at line 2146 of file timestamp.c.
References fb(), and USECS_PER_SEC.
Referenced by make_timestamptz_at_timezone(), timestamp2timestamptz_safe(), timestamp_izone(), timestamp_zone(), timestamptz_izone(), timestamptz_zone(), tm2timestamp(), and tm2timestamp().
Definition at line 1891 of file timestamp.c.
References fb(), USECS_PER_HOUR, USECS_PER_MINUTE, and USECS_PER_SEC.
Referenced by DecodeDateTime(), DecodeTimeOnly(), timestamp2tm(), and timestamp2tm().
Definition at line 1602 of file timestamp.c.
References EARLY, elog, ERROR, fb(), INTERVAL_IS_NOBEGIN, INTERVAL_IS_NOEND, LATE, and str.
Referenced by interval_out().
Definition at line 1591 of file timestamp.c.
References EARLY, elog, ERROR, fb(), LATE, str, TIMESTAMP_IS_NOBEGIN, and TIMESTAMP_IS_NOEND.
Referenced by JsonEncodeDateTime(), pg_get_role_ddl_internal(), PGTYPEStimestamp_to_asc(), timestamp_out(), timestamptz_out(), and timestamptz_to_str().
| Datum extract_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6329 of file timestamp.c.
References interval_part_common().
| Datum extract_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5779 of file timestamp.c.
References timestamp_part_common().
| Datum extract_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6052 of file timestamp.c.
References timestamptz_part_common().
|
static |
Definition at line 3563 of file timestamp.c.
References Assert, ereport, errcode(), errmsg, ERROR, fb(), INTERVAL_NOT_FINITE, pg_sub_s32_overflow(), pg_sub_s64_overflow(), and result.
Referenced by do_interval_discard(), and interval_mi().
|
static |
Definition at line 3507 of file timestamp.c.
References Assert, ereport, errcode(), errmsg, ERROR, fb(), INTERVAL_NOT_FINITE, pg_add_s32_overflow(), pg_add_s64_overflow(), and result.
Referenced by do_interval_accum(), interval_avg_combine(), and interval_pl().
| Datum float8_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 722 of file timestamp.c.
References DATETIME_MIN_JULIAN, ereport, errcode(), errmsg, ERROR, fb(), IS_VALID_TIMESTAMP, PG_GETARG_FLOAT8, PG_RETURN_TIMESTAMP, POSTGRES_EPOCH_JDATE, result, SECS_PER_DAY, TIMESTAMP_END_JULIAN, TIMESTAMP_NOBEGIN, TIMESTAMP_NOEND, UNIX_EPOCH_JDATE, and USECS_PER_SEC.
| Datum generate_series_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6721 of file timestamp.c.
References DatumGetTimestamp(), DirectFunctionCall2, ereport, errcode(), errmsg, ERROR, fb(), INTERVAL_NOT_FINITE, interval_sign(), MemoryContextSwitchTo(), palloc_object, PG_GETARG_INTERVAL_P, PG_GETARG_TIMESTAMP, PointerGetDatum, result, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, start, timestamp_cmp_internal(), timestamp_pl_interval(), and TimestampGetDatum().
| Datum generate_series_timestamp_support | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6901 of file timestamp.c.
References DatumGetIntervalP(), DatumGetTimestamp(), DirectFunctionCall2, estimate_expression_value(), fb(), INTERVAL_TO_MICROSECONDS, is_funcclause(), IsA, linitial, lsecond, lthird, PG_GETARG_POINTER, PG_RETURN_POINTER, pg_sub_s64_overflow(), start, timestamp_mi(), TIMESTAMP_NOT_FINITE, and TimestampGetDatum().
| Datum generate_series_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6886 of file timestamp.c.
References generate_series_timestamptz_internal().
| Datum generate_series_timestamptz_at_zone | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6892 of file timestamp.c.
References generate_series_timestamptz_internal().
|
static |
Definition at line 6805 of file timestamp.c.
References ereport, errcode(), errmsg, ERROR, fb(), INTERVAL_NOT_FINITE, interval_sign(), lookup_timezone(), MemoryContextSwitchTo(), palloc_object, PG_GETARG_INTERVAL_P, PG_GETARG_TEXT_PP, PG_GETARG_TIMESTAMPTZ, PG_NARGS, result, session_timezone, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, start, timestamp_cmp_internal(), timestamptz_pl_interval_internal(), and TimestampTzGetDatum().
Referenced by generate_series_timestamptz(), and generate_series_timestamptz_at_zone().
| TimestampTz GetCurrentTimestamp | ( | void | ) |
Definition at line 1649 of file timestamp.c.
References fb(), gettimeofday(), POSTGRES_EPOCH_JDATE, result, SECS_PER_DAY, UNIX_EPOCH_JDATE, and USECS_PER_SEC.
Referenced by ApplyLauncherMain(), asyncQueueFillWarning(), autoprewarm_main(), AutoVacLauncherMain(), BackendStartup(), BackgroundWriterMain(), bbsink_copystream_archive_contents(), bbsink_copystream_end_archive(), bbsink_copystream_new(), bbsink_throttle_begin_backup(), check_log_duration(), CheckPointGuts(), CleanupBackend(), clock_timestamp(), CreateCheckPoint(), CreateEndOfRecoveryRecord(), CreateOverwriteContrecordRecord(), CreateRestartPoint(), dblink_cancel_query(), DetermineSleepTime(), disable_timeout(), disable_timeouts(), do_analyze_rel(), do_start_worker(), enable_startup_progress_timeout(), enable_timeout_after(), enable_timeout_at(), enable_timeout_every(), enable_timeouts(), entry_alloc(), entry_reset(), get_candidate_xid(), get_role_password(), GetCurrentTransactionStopTimestamp(), GetReplicationApplyDelay(), handle_sig_alarm(), has_startup_progress_timeout_expired(), heap_vacuum_rel(), initialize_prng(), InitProcessGlobals(), InvalidatePossiblyObsoleteSlot(), IoWorkerMain(), KnownAssignedXidsCompress(), launch_sync_worker(), launcher_determine_sleep(), libpqsrv_cancel(), LockBufferForCleanup(), log_disconnections(), LogCheckpointEnd(), logicalrep_worker_launch(), LogicalRepApplyLoop(), maybe_start_bgworkers(), maybe_start_io_workers(), pa_send_data(), PerformAuthentication(), PerformWalRecovery(), pg_promote(), pg_sleep(), pg_stash_advice_worker_main(), pgfdw_abort_cleanup_begin(), pgfdw_cancel_query(), pgfdw_exec_cleanup_query(), pgfdw_finish_abort_cleanup(), pgfdw_get_cleanup_result(), pgss_shmem_init(), pgstat_build_snapshot(), pgstat_report_activity(), pgstat_report_analyze(), pgstat_report_archiver(), pgstat_report_autovac(), pgstat_report_checksum_failures_in_db(), pgstat_report_replslotsync(), pgstat_report_stat(), pgstat_report_vacuum(), pgstat_reset(), pgstat_reset_after_failure(), pgstat_reset_counters(), pgstat_reset_of_kind(), pgstat_reset_slru(), PostgresMain(), PostgresSingleUserMain(), postmaster_child_launch(), PostmasterMain(), PrepareTransaction(), ProcessConfigFileInternal(), ProcessPendingWrites(), ProcessRepliesIfAny(), ProcessStandbyPSRequestMessage(), ProcessStandbyReplyMessage(), ProcessWalSndrMessage(), ProcSleep(), rebuild_database_list(), RecordTransactionAbort(), RecordTransactionAbortPrepared(), RecordTransactionCommitPrepared(), recoveryApplyDelay(), ReplicationSlotRelease(), request_publisher_status(), reschedule_timeouts(), ResolveRecoveryConflictWithBufferPin(), ResolveRecoveryConflictWithLock(), ResolveRecoveryConflictWithVirtualXIDs(), RestoreSlotFromDisk(), send_feedback(), SetCurrentStatementStartTimestamp(), SetupApplyOrSyncWorker(), should_stop_conflict_info_retention(), StartBackgroundWorker(), StartTransaction(), test_pattern(), test_random(), test_random_operations(), throttle(), update_synced_slots_inactive_since(), UpdateWorkerStats(), wait_for_local_flush(), WaitExceedsMaxStandbyDelay(), WaitForLSN(), WaitForWalSummarization(), WaitForWALToBecomeAvailable(), WalReceiverMain(), WalSndCheckShutdownTimeout(), WalSndDone(), WalSndKeepalive(), WalSndLoop(), WalSndUpdateProgress(), WalSndWaitForWal(), WalSndWriteData(), XLogBackgroundFlush(), XLogFileRead(), XLogPrefetchResetStats(), XLogPrefetchShmemInit(), XLogRestorePoint(), XLogSendPhysical(), XLogWalRcvSendHSFeedback(), and XLogWalRcvSendReply().
Definition at line 2180 of file timestamp.c.
References elog, epoch, ERROR, fb(), pg_gmtime(), tm, pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, and pg_tm::tm_year.
Referenced by date_in(), PGTYPESdate_from_asc(), SetEpochTimestamp(), and SetEpochTimestamp().
| TimestampTz GetSQLCurrentTimestamp | ( | int32 | typmod | ) |
Definition at line 1667 of file timestamp.c.
References AdjustTimestampForTypmod(), fb(), and GetCurrentTransactionStartTimestamp().
Referenced by ExecEvalSQLValueFunction().
Definition at line 1681 of file timestamp.c.
References AdjustTimestampForTypmod(), fb(), GetCurrentTransactionStartTimestamp(), and timestamptz2timestamp().
Referenced by ExecEvalSQLValueFunction().
| Datum in_range_interval_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3936 of file timestamp.c.
References DatumGetIntervalP(), DirectFunctionCall2, ereport, errcode(), errmsg, ERROR, fb(), interval_cmp_internal(), INTERVAL_IS_NOBEGIN, INTERVAL_IS_NOEND, interval_mi(), interval_pl(), interval_sign(), IntervalPGetDatum(), PG_GETARG_BOOL, PG_GETARG_INTERVAL_P, PG_RETURN_BOOL, and val.
| Datum in_range_timestamp_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3895 of file timestamp.c.
References DatumGetTimestamp(), DirectFunctionCall2, ereport, errcode(), errmsg, ERROR, fb(), INTERVAL_IS_NOEND, interval_sign(), IntervalPGetDatum(), PG_GETARG_BOOL, PG_GETARG_INTERVAL_P, PG_GETARG_TIMESTAMP, PG_RETURN_BOOL, TIMESTAMP_IS_NOBEGIN, TIMESTAMP_IS_NOEND, timestamp_mi_interval(), timestamp_pl_interval(), TimestampGetDatum(), and val.
Referenced by in_range_date_interval().
| Datum in_range_timestamptz_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3858 of file timestamp.c.
References ereport, errcode(), errmsg, ERROR, fb(), INTERVAL_IS_NOEND, interval_sign(), PG_GETARG_BOOL, PG_GETARG_INTERVAL_P, PG_GETARG_TIMESTAMPTZ, PG_RETURN_BOOL, TIMESTAMP_IS_NOBEGIN, TIMESTAMP_IS_NOEND, timestamptz_mi_interval_internal(), timestamptz_pl_interval_internal(), and val.
Definition at line 2057 of file timestamp.c.
References fb(), MONTHS_PER_YEAR, USECS_PER_HOUR, USECS_PER_MINUTE, and USECS_PER_SEC.
Referenced by interval_out(), interval_part_common(), interval_to_char(), and interval_trunc().
| Datum interval_avg | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4227 of file timestamp.c.
References DirectFunctionCall2, ereport, errcode(), errmsg, ERROR, fb(), Float8GetDatum(), IA_TOTAL_COUNT, interval_div(), INTERVAL_NOBEGIN, INTERVAL_NOEND, IntervalPGetDatum(), palloc_object, PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_INTERVAL_P, PG_RETURN_NULL, and result.
| Datum interval_avg_accum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4062 of file timestamp.c.
References do_interval_accum(), fb(), makeIntervalAggState(), PG_ARGISNULL, PG_GETARG_INTERVAL_P, PG_GETARG_POINTER, and PG_RETURN_POINTER.
| Datum interval_avg_accum_inv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4209 of file timestamp.c.
References do_interval_discard(), elog, ERROR, fb(), PG_ARGISNULL, PG_GETARG_INTERVAL_P, PG_GETARG_POINTER, and PG_RETURN_POINTER.
| Datum interval_avg_combine | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4085 of file timestamp.c.
References fb(), finite_interval_pl(), makeIntervalAggState(), PG_ARGISNULL, PG_GETARG_POINTER, and PG_RETURN_POINTER.
| Datum interval_avg_deserialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4166 of file timestamp.c.
References AggCheckCallContext(), buf, elog, ERROR, fb(), initReadOnlyStringInfo(), palloc0_object, PG_GETARG_BYTEA_PP, PG_RETURN_POINTER, pq_getmsgend(), pq_getmsgint(), pq_getmsgint64(), result, VARDATA_ANY(), and VARSIZE_ANY_EXHDR().
| Datum interval_avg_serialize | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4128 of file timestamp.c.
References AggCheckCallContext(), buf, elog, ERROR, fb(), PG_GETARG_POINTER, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendint32(), pq_sendint64(), and result.
| Datum interval_cmp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2630 of file timestamp.c.
References fb(), interval_cmp_internal(), PG_GETARG_INTERVAL_P, and PG_RETURN_INT32.
Referenced by gbt_intv_ssup_cmp(), and gbt_intvkey_cmp().
Definition at line 2558 of file timestamp.c.
References fb(), int128_compare(), and interval_cmp_value().
Referenced by in_range_interval_interval(), interval_cmp(), interval_eq(), interval_ge(), interval_gt(), interval_larger(), interval_le(), interval_lt(), interval_ne(), and interval_smaller().
Definition at line 2536 of file timestamp.c.
References days, fb(), int128_add_int64_mul_int64(), int64_to_int128(), INT64CONST, interval::month, interval::time, and USECS_PER_DAY.
Referenced by interval_cmp_internal(), interval_hash(), interval_hash_extended(), and interval_sign().
| Datum interval_div | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3757 of file timestamp.c.
References DAYS_PER_MONTH, ereport, errcode(), errmsg, ERROR, fb(), FLOAT8_FITS_IN_INT32, FLOAT8_FITS_IN_INT64, INTERVAL_NOT_FINITE, interval_um_internal(), memcpy(), palloc_object, pg_add_s32_overflow(), PG_GETARG_FLOAT8, PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, PG_RETURN_NULL, result, SECS_PER_DAY, TSROUND, and USECS_PER_SEC.
Referenced by interval_avg().
| Datum interval_eq | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2576 of file timestamp.c.
References fb(), interval_cmp_internal(), PG_GETARG_INTERVAL_P, and PG_RETURN_BOOL.
Referenced by gbt_intveq().
| Datum interval_finite | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2167 of file timestamp.c.
References INTERVAL_NOT_FINITE, PG_GETARG_INTERVAL_P, and PG_RETURN_BOOL.
| Datum interval_ge | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2621 of file timestamp.c.
References fb(), interval_cmp_internal(), PG_GETARG_INTERVAL_P, and PG_RETURN_BOOL.
Referenced by gbt_intvge().
| Datum interval_gt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2603 of file timestamp.c.
References fb(), interval_cmp_internal(), PG_GETARG_INTERVAL_P, and PG_RETURN_BOOL.
Referenced by gbt_intvgt().
| Datum interval_hash | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2646 of file timestamp.c.
References DirectFunctionCall1, fb(), hashint8(), int128_to_int64(), Int64GetDatumFast, interval_cmp_value(), and PG_GETARG_INTERVAL_P.
| Datum interval_hash_extended | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2664 of file timestamp.c.
References DirectFunctionCall2, fb(), hashint8extended(), int128_to_int64(), Int64GetDatumFast, interval_cmp_value(), PG_GETARG_DATUM, and PG_GETARG_INTERVAL_P.
| Datum interval_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 891 of file timestamp.c.
References AdjustIntervalForTypmod(), DateTimeParseError(), DecodeInterval(), DecodeISO8601Interval(), DTERR_BAD_FORMAT, DTERR_FIELD_OVERFLOW, DTERR_INTERVAL_OVERFLOW, DTK_DELTA, DTK_EARLY, DTK_LATE, elog, ereturn, errcode(), errmsg, ERROR, fb(), INTERVAL_FULL_RANGE, INTERVAL_NOBEGIN, INTERVAL_NOEND, INTERVAL_RANGE, itmin2interval(), MAXDATEFIELDS, palloc_object, ParseDateTime(), PG_GETARG_CSTRING, PG_GETARG_INT32, PG_GETARG_OID, PG_RETURN_INTERVAL_P, PG_RETURN_NULL, range(), result, and str.
Referenced by check_timezone(), and flatten_set_variable_args().
| Datum interval_justify_days | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3056 of file timestamp.c.
References DAYS_PER_MONTH, ereport, errcode(), errmsg, ERROR, fb(), INTERVAL_NOT_FINITE, palloc_object, pg_add_s32_overflow(), PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, and result.
| Datum interval_justify_hours | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3014 of file timestamp.c.
References ereport, errcode(), errmsg, ERROR, fb(), INTERVAL_NOT_FINITE, palloc_object, pg_add_s32_overflow(), PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, result, TMODULO, and USECS_PER_DAY.
Referenced by timestamp_mi().
| Datum interval_justify_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2934 of file timestamp.c.
References DAYS_PER_MONTH, ereport, errcode(), errmsg, ERROR, fb(), INTERVAL_NOT_FINITE, palloc_object, pg_add_s32_overflow(), PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, result, TMODULO, and USECS_PER_DAY.
| Datum interval_larger | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3493 of file timestamp.c.
References fb(), interval_cmp_internal(), PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, and result.
| Datum interval_le | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2612 of file timestamp.c.
References fb(), interval_cmp_internal(), PG_GETARG_INTERVAL_P, and PG_RETURN_BOOL.
Referenced by gbt_intvle().
| Datum interval_lt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2594 of file timestamp.c.
References fb(), interval_cmp_internal(), PG_GETARG_INTERVAL_P, and PG_RETURN_BOOL.
Referenced by abs_interval(), and gbt_intvlt().
| Datum interval_mi | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3578 of file timestamp.c.
References ereport, errcode(), errmsg, ERROR, fb(), finite_interval_mi(), INTERVAL_IS_NOBEGIN, INTERVAL_IS_NOEND, INTERVAL_NOBEGIN, INTERVAL_NOEND, palloc_object, PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, and result.
Referenced by in_range_interval_interval(), interval_dist(), and interval_lerp().
| Datum interval_mul | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3627 of file timestamp.c.
References DAYS_PER_MONTH, ereport, errcode(), errmsg, ERROR, fb(), FLOAT8_FITS_IN_INT32, FLOAT8_FITS_IN_INT64, INTERVAL_NOBEGIN, INTERVAL_NOEND, INTERVAL_NOT_FINITE, interval_sign(), interval_um_internal(), memcpy(), palloc_object, pg_add_s32_overflow(), PG_GETARG_FLOAT8, PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, PG_RETURN_NULL, result, SECS_PER_DAY, TSROUND, and USECS_PER_SEC.
Referenced by interval_lerp(), and mul_d_interval().
| Datum interval_ne | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2585 of file timestamp.c.
References fb(), interval_cmp_internal(), PG_GETARG_INTERVAL_P, and PG_RETURN_BOOL.
| Datum interval_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 974 of file timestamp.c.
References buf, EncodeInterval(), EncodeSpecialInterval(), fb(), interval2itm(), INTERVAL_NOT_FINITE, IntervalStyle, MAXDATELEN, PG_GETARG_INTERVAL_P, PG_RETURN_CSTRING, pstrdup(), and result.
Referenced by flatten_set_variable_args(), timestamp_izone(), timestamptz_izone(), and timetz_izone().
| Datum interval_part | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6323 of file timestamp.c.
References interval_part_common().
|
static |
Definition at line 6116 of file timestamp.c.
References CStringGetDatum(), DAYS_PER_MONTH, DAYS_PER_YEAR, DecodeSpecial(), DecodeUnits(), DirectFunctionCall3, 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_WEEK, DTK_YEAR, ereport, errcode(), errmsg, ERROR, fb(), format_type_be(), Int32GetDatum(), int64_div_fast_to_numeric(), int64_to_numeric(), INT64CONST, interval2itm(), INTERVAL_IS_NOBEGIN, INTERVAL_NOT_FINITE, InvalidOid, interval::month, MONTHS_PER_YEAR, NonFiniteIntervalPart(), numeric_add_safe(), numeric_in(), ObjectIdGetDatum(), pg_add_s64_overflow(), PG_GETARG_INTERVAL_P, PG_GETARG_TEXT_PP, pg_mul_s64_overflow(), PG_RETURN_FLOAT8, PG_RETURN_NULL, PG_RETURN_NUMERIC, RESERV, result, SECS_PER_DAY, interval::time, 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, type, UNITS, UNKNOWN_FIELD, val, VARDATA_ANY(), and VARSIZE_ANY_EXHDR().
Referenced by extract_interval(), and interval_part().
| Datum interval_pl | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3522 of file timestamp.c.
References ereport, errcode(), errmsg, ERROR, fb(), finite_interval_pl(), INTERVAL_IS_NOBEGIN, INTERVAL_IS_NOEND, INTERVAL_NOBEGIN, INTERVAL_NOEND, INTERVAL_NOT_FINITE, memcpy(), palloc_object, PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, and result.
Referenced by in_range_interval_interval(), and interval_lerp().
| Datum interval_recv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 998 of file timestamp.c.
References AdjustIntervalForTypmod(), buf, fb(), interval::month, palloc_object, PG_GETARG_INT32, PG_GETARG_OID, PG_GETARG_POINTER, PG_RETURN_INTERVAL_P, pq_getmsgint(), pq_getmsgint64(), and interval::time.
| Datum interval_scale | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1330 of file timestamp.c.
References AdjustIntervalForTypmod(), palloc_object, PG_GETARG_INT32, PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, PG_RETURN_NULL, and result.
| Datum interval_send | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1023 of file timestamp.c.
References buf, interval::month, PG_GETARG_INTERVAL_P, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendint32(), pq_sendint64(), and interval::time.
Definition at line 2567 of file timestamp.c.
References fb(), int128_compare(), int64_to_int128(), and interval_cmp_value().
Referenced by generate_series_timestamp(), generate_series_timestamptz_internal(), in_range_interval_interval(), in_range_timestamp_interval(), in_range_timestamptz_interval(), and interval_mul().
| Datum interval_smaller | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3478 of file timestamp.c.
References fb(), interval_cmp_internal(), PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, and result.
| Datum interval_sum | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4267 of file timestamp.c.
References ereport, errcode(), errmsg, ERROR, fb(), IA_TOTAL_COUNT, INTERVAL_NOBEGIN, INTERVAL_NOEND, memcpy(), palloc_object, PG_ARGISNULL, PG_GETARG_POINTER, PG_RETURN_INTERVAL_P, PG_RETURN_NULL, and result.
| Datum interval_support | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1266 of file timestamp.c.
References FuncExpr::args, Assert, DatumGetInt32(), exprTypmod(), fb(), INTERVAL_FULL_PRECISION, INTERVAL_PRECISION, intervaltypmodleastfield(), IsA, linitial, list_length(), lsecond, MAX_INTERVAL_PRECISION, PG_GETARG_POINTER, PG_RETURN_POINTER, relabel_to_typmod(), and source.
| Datum interval_trunc | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5139 of file timestamp.c.
References DecodeUnits(), downcase_truncate_identifier(), DTK_CENTURY, DTK_DAY, DTK_DECADE, DTK_HOUR, DTK_MICROSEC, DTK_MILLENNIUM, DTK_MILLISEC, DTK_MINUTE, DTK_MONTH, DTK_QUARTER, DTK_SECOND, DTK_WEEK, DTK_YEAR, ereport, errcode(), errdetail(), errmsg, ERROR, fb(), format_type_be(), interval2itm(), INTERVAL_NOT_FINITE, itm2interval(), memcpy(), palloc_object, pg_fallthrough, PG_GETARG_INTERVAL_P, PG_GETARG_TEXT_PP, PG_RETURN_INTERVAL_P, result, 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, type, UNITS, val, VARDATA_ANY(), and VARSIZE_ANY_EXHDR().
| Datum interval_um | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3465 of file timestamp.c.
References interval_um_internal(), palloc_object, PG_GETARG_INTERVAL_P, PG_RETURN_INTERVAL_P, and result.
Referenced by abs_interval().
Definition at line 3445 of file timestamp.c.
References ereport, errcode(), errmsg, ERROR, fb(), INT64CONST, INTERVAL_IS_NOBEGIN, INTERVAL_IS_NOEND, INTERVAL_NOBEGIN, INTERVAL_NOEND, INTERVAL_NOT_FINITE, interval::month, pg_sub_s32_overflow(), pg_sub_s64_overflow(), result, and interval::time.
Referenced by interval_div(), interval_mul(), interval_um(), timestamp_mi_interval(), and timestamptz_mi_interval_internal().
| Datum intervaltypmodin | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1048 of file timestamp.c.
References ArrayGetIntegerTypmods(), DAY, ereport, errcode(), errmsg, ERROR, fb(), HOUR, INTERVAL_FULL_PRECISION, INTERVAL_FULL_RANGE, INTERVAL_MASK, INTERVAL_TYPMOD, MAX_INTERVAL_PRECISION, MINUTE, MONTH, PG_GETARG_ARRAYTYPE_P, PG_RETURN_INT32, SECOND, WARNING, and YEAR.
Definition at line 1213 of file timestamp.c.
References DAY, elog, ERROR, HOUR, INTERVAL_FULL_RANGE, INTERVAL_MASK, INTERVAL_RANGE, MINUTE, MONTH, SECOND, and YEAR.
Referenced by interval_support().
| Datum intervaltypmodout | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1127 of file timestamp.c.
References DAY, elog, ERROR, fb(), HOUR, INTERVAL_FULL_PRECISION, INTERVAL_FULL_RANGE, INTERVAL_MASK, INTERVAL_PRECISION, INTERVAL_RANGE, MINUTE, MONTH, palloc(), PG_GETARG_INT32, PG_RETURN_CSTRING, SECOND, snprintf, and YEAR.
Definition at line 5293 of file timestamp.c.
References fb(), isoweek2j(), and j2date().
Referenced by do_to_timestamp(), timestamp_trunc(), and timestamptz_trunc_internal().
Definition at line 5272 of file timestamp.c.
References date2j(), fb(), and j2day().
Referenced by date2isoyearday(), do_to_timestamp(), isoweek2date(), and isoweekdate2date().
Definition at line 5307 of file timestamp.c.
References fb(), isoweek2j(), and j2date().
Referenced by do_to_timestamp().
Definition at line 2088 of file timestamp.c.
References fb(), INTERVAL_NOT_FINITE, MONTHS_PER_YEAR, pg_add_s64_overflow(), pg_mul_s64_overflow(), USECS_PER_HOUR, USECS_PER_MINUTE, and USECS_PER_SEC.
Referenced by interval_trunc(), timestamp_age(), and timestamptz_age().
Definition at line 2127 of file timestamp.c.
References fb(), and MONTHS_PER_YEAR.
Referenced by interval_in(), pg_timezone_abbrevs_abbrevs(), pg_timezone_abbrevs_zone(), and pg_timezone_names().
Definition at line 556 of file timestamp.c.
References DecodeTimezoneNameToTz(), fb(), text_to_cstring_buffer(), and TZ_STRLEN_MAX.
Referenced by generate_series_timestamptz_internal(), timestamptz_mi_interval_at_zone(), timestamptz_pl_interval_at_zone(), and timestamptz_trunc_zone().
| Datum make_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1533 of file timestamp.c.
References days, DAYS_PER_WEEK, ereport, errcode(), errmsg, ERROR, fb(), FLOAT8_FITS_IN_INT64, float8_mul(), INTERVAL_NOT_FINITE, months, MONTHS_PER_YEAR, palloc_object, pg_add_s32_overflow(), pg_add_s64_overflow(), PG_GETARG_FLOAT8, PG_GETARG_INT32, pg_mul_s32_overflow(), PG_RETURN_INTERVAL_P, PG_RETURN_NULL, result, USECS_PER_HOUR, USECS_PER_MINUTE, and USECS_PER_SEC.
| Datum make_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 641 of file timestamp.c.
References fb(), make_timestamp_internal(), PG_GETARG_FLOAT8, PG_GETARG_INT32, PG_RETURN_TIMESTAMP, and result.
|
static |
Definition at line 570 of file timestamp.c.
References date2j(), DTK_DATE_M, ereport, errcode(), errmsg, ERROR, fb(), float_time_overflows(), IS_VALID_JULIAN, IS_VALID_TIMESTAMP, MINS_PER_HOUR, pg_add_s64_overflow(), pg_mul_s64_overflow(), POSTGRES_EPOCH_JDATE, result, SECS_PER_MINUTE, tm, pg_tm::tm_mday, pg_tm::tm_mon, pg_tm::tm_year, unlikely, USECS_PER_DAY, USECS_PER_SEC, and ValidateDate().
Referenced by make_timestamp(), make_timestamptz(), and make_timestamptz_at_timezone().
| Datum make_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 661 of file timestamp.c.
References fb(), make_timestamp_internal(), PG_GETARG_FLOAT8, PG_GETARG_INT32, PG_RETURN_TIMESTAMPTZ, result, and timestamp2timestamptz().
| Datum make_timestamptz_at_timezone | ( | PG_FUNCTION_ARGS | ) |
Definition at line 682 of file timestamp.c.
References dt2local(), ereport, errcode(), errmsg, ERROR, fb(), IS_VALID_TIMESTAMP, make_timestamp_internal(), parse_sane_timezone(), PG_GETARG_FLOAT8, PG_GETARG_INT32, PG_GETARG_TEXT_PP, PG_RETURN_TIMESTAMPTZ, result, and timestamp2tm().
|
static |
Definition at line 3986 of file timestamp.c.
References AggCheckCallContext(), elog, ERROR, fb(), MemoryContextSwitchTo(), and palloc0_object.
Referenced by interval_avg_accum(), and interval_avg_combine().
| Datum mul_d_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3747 of file timestamp.c.
References DirectFunctionCall2, fb(), interval_mul(), and PG_GETARG_DATUM.
Definition at line 6069 of file timestamp.c.
References 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_WEEK, DTK_YEAR, ereport, errcode(), errmsg, ERROR, fb(), format_type_be(), get_float8_infinity(), RESERV, type, and UNITS.
Referenced by interval_part_common().
|
static |
Definition at line 5457 of file timestamp.c.
References DTK_CENTURY, DTK_DAY, DTK_DECADE, DTK_DOW, DTK_DOY, DTK_EPOCH, DTK_HOUR, DTK_ISODOW, DTK_ISOYEAR, DTK_JULIAN, DTK_MICROSEC, DTK_MILLENNIUM, DTK_MILLISEC, DTK_MINUTE, DTK_MONTH, DTK_QUARTER, DTK_SECOND, DTK_TZ, DTK_TZ_HOUR, DTK_TZ_MINUTE, DTK_WEEK, DTK_YEAR, ereport, errcode(), errmsg, ERROR, fb(), format_type_be(), get_float8_infinity(), RESERV, type, and UNITS.
Referenced by timestamp_part_common(), and timestamptz_part_common().
| Datum now | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1613 of file timestamp.c.
References GetCurrentTransactionStartTimestamp(), and PG_RETURN_TIMESTAMPTZ.
Referenced by advanceConnectionState(), ApplyLauncherMain(), BackgroundWriterMain(), bbsink_copystream_archive_contents(), CalculateCopyStreamSleeptime(), CheckArchiveTimeout(), CheckpointerMain(), DetermineSlotInvalidationCause(), doLog(), doRetry(), dumpTimestamp(), enable_timeout(), enable_timeout_after(), enable_timeout_at(), enable_timeout_every(), enable_timeouts(), executeMetaCommand(), flushAndSendFeedback(), get_candidate_xid(), get_role_password(), handle_sig_alarm(), HandleCopyStream(), has_startup_progress_timeout_expired(), initialize_prng(), InvalidatePossiblyObsoleteSlot(), IoWorkerMain(), IsCheckpointOnSchedule(), LagTrackerRead(), launch_sync_worker(), launch_worker(), libpqsrv_cancel(), LockBufferForCleanup(), logicalrep_worker_launch(), LogicalRepApplyLoop(), LogRecoveryConflict(), make_output_dirs(), maybe_start_bgworkers(), maybe_start_io_workers(), mxid_age(), OutputFsync(), pg_get_ticks_system(), pg_time_now(), pg_time_now_lazy(), pg_timezone_abbrevs_abbrevs(), pg_timezone_abbrevs_zone(), pgfdw_cancel_query(), pgfdw_finish_abort_cleanup(), pgfdw_get_cleanup_result(), pgstat_report_archiver(), pgstat_report_stat(), PQsocketPoll(), pqTraceFormatTimestamp(), printProgressReport(), printVerboseErrorMessages(), ProcessKeepaliveMsg(), ProcessStandbyReplyMessage(), processXactStats(), ProcSleep(), progress_report(), progress_report(), progress_report(), progress_report(), progress_report(), ReplicationSlotRelease(), RequestXLogStreaming(), ResolveRecoveryConflictWithLock(), ResolveRecoveryConflictWithVirtualXIDs(), RestoreSlotFromDisk(), schedule_alarm(), send_feedback(), sendFeedback(), sendFeedback(), ServerLoop(), set_next_rotation_time(), should_stop_conflict_info_retention(), StreamLogicalLog(), SysLoggerMain(), threadRun(), timetz_zone(), update_synced_slots_inactive_since(), wait_for_local_flush(), WaitForWALToBecomeAvailable(), WalRcvComputeNextWakeup(), WalRcvRunning(), WalRcvStreaming(), WalReceiverMain(), WalSndCheckShutdownTimeout(), WalSndComputeSleeptime(), WalSndLoop(), WalSndUpdateProgress(), WalSndWaitForWal(), WalSndWriteData(), xid_age(), XLogBackgroundFlush(), XLogWalRcvSendHSFeedback(), and XLogWalRcvSendReply().
| Datum overlaps_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2685 of file timestamp.c.
References fb(), PG_ARGISNULL, PG_GETARG_DATUM, PG_RETURN_BOOL, PG_RETURN_NULL, TIMESTAMP_GT, and TIMESTAMP_LT.
Definition at line 487 of file timestamp.c.
References DecodeTimezone(), DecodeTimezoneName(), DetermineTimeZoneAbbrevOffset(), DetermineTimeZoneOffset(), DTERR_BAD_FORMAT, DTERR_TZDISP_OVERFLOW, ereport, errcode(), errhint(), errmsg, ERROR, fb(), text_to_cstring_buffer(), tm, type, TZ_STRLEN_MAX, TZNAME_DYNTZ, TZNAME_FIXED_OFFSET, and val.
Referenced by make_timestamptz_at_timezone().
| Datum pg_conf_load_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1637 of file timestamp.c.
References PG_RETURN_TIMESTAMPTZ, and PgReloadTime.
| Datum pg_postmaster_start_time | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1631 of file timestamp.c.
References PG_RETURN_TIMESTAMPTZ, and PgStartTime.
Definition at line 2202 of file timestamp.c.
References fb(), GetEpochTime(), tm, and tm2timestamp().
Referenced by dttofmtasc_replace(), PGTYPEStimestamp_from_asc(), timestamp_in(), timestamp_part_common(), timestamptz_in(), and timestamptz_part_common().
| Datum statement_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1619 of file timestamp.c.
References GetCurrentStatementStartTimestamp(), and PG_RETURN_TIMESTAMPTZ.
Definition at line 2140 of file timestamp.c.
References fb(), MINS_PER_HOUR, SECS_PER_MINUTE, and USECS_PER_SEC.
Referenced by tm2timestamp(), and tm2timestamp().
| TimestampTz time_t_to_timestamptz | ( | pg_time_t | tm | ) |
Definition at line 1828 of file timestamp.c.
References POSTGRES_EPOCH_JDATE, result, SECS_PER_DAY, tm, UNIX_EPOCH_JDATE, and USECS_PER_SEC.
Referenced by pg_control_checkpoint(), pg_control_system(), pg_ls_dir_files(), and pg_stat_file().
| Datum timeofday | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1695 of file timestamp.c.
References buf, cstring_to_text(), fb(), gettimeofday(), pg_localtime(), PG_RETURN_TEXT_P, pg_strftime(), session_timezone, snprintf, and tm.
|
static |
Definition at line 6529 of file timestamp.c.
References fb(), and timestamp2timestamptz_safe().
Referenced by make_timestamptz().
| TimestampTz timestamp2timestamptz_safe | ( | Timestamp | timestamp, |
| Node * | escontext | ||
| ) |
Definition at line 6493 of file timestamp.c.
References DetermineTimeZoneOffset(), dt2local(), ereturn, errcode(), errmsg, fb(), IS_VALID_TIMESTAMP, result, session_timezone, timestamp2tm(), TIMESTAMP_NOBEGIN, TIMESTAMP_NOEND, TIMESTAMP_NOT_FINITE, and tm.
Referenced by cvt_timestamp_timestamptz(), timestamp2timestamptz(), timestamp_cmp_timestamptz_internal(), and timestamp_timestamptz().
| int timestamp2tm | ( | Timestamp | dt, |
| int * | tzp, | ||
| struct pg_tm * | tm, | ||
| fsec_t * | fsec, | ||
| const char ** | tzn, | ||
| pg_tz * | attimezone | ||
| ) |
Definition at line 1918 of file timestamp.c.
References dt2time(), fb(), INT64CONST, j2date(), pg_localtime(), POSTGRES_EPOCH_JDATE, SECS_PER_DAY, session_timezone, tm, pg_tm::tm_gmtoff, pg_tm::tm_hour, pg_tm::tm_isdst, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, pg_tm::tm_year, pg_tm::tm_zone, TMODULO, UNIX_EPOCH_JDATE, USECS_PER_DAY, and USECS_PER_SEC.
Referenced by DetermineTimeZoneAbbrevOffsetTS(), executeDateTimeMethod(), GetCurrentTimeUsec(), JsonEncodeDateTime(), make_timestamptz_at_timezone(), map_sql_value_to_xml_value(), pg_get_role_ddl_internal(), pg_timezone_names(), PGTYPEStimestamp_add_interval(), PGTYPEStimestamp_fmt_asc(), PGTYPEStimestamp_to_asc(), timestamp2date_safe(), timestamp2timestamptz_safe(), timestamp_age(), timestamp_out(), timestamp_part_common(), timestamp_pl_interval(), timestamp_recv(), timestamp_time(), timestamp_to_char(), timestamp_trunc(), timestamp_zone(), timestamptz2date_safe(), timestamptz2timestamp_safe(), timestamptz_age(), timestamptz_out(), timestamptz_part_common(), timestamptz_pl_interval_internal(), timestamptz_recv(), timestamptz_time(), timestamptz_timetz(), timestamptz_to_char(), timestamptz_to_str(), timestamptz_trunc_internal(), timestamptz_zone(), and timetz_zone().
| Datum timestamp_age | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4308 of file timestamp.c.
References day_tab, ereport, errcode(), errmsg, ERROR, fb(), HOURS_PER_DAY, INTERVAL_NOBEGIN, INTERVAL_NOEND, isleap, itm2interval(), MINS_PER_HOUR, MONTHS_PER_YEAR, palloc_object, PG_GETARG_TIMESTAMP, PG_RETURN_INTERVAL_P, result, SECS_PER_MINUTE, timestamp2tm(), TIMESTAMP_IS_NOBEGIN, TIMESTAMP_IS_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, and USECS_PER_SEC.
| Datum timestamp_at_local | ( | PG_FUNCTION_ARGS | ) |
| Datum timestamp_bin | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4610 of file timestamp.c.
References ereport, errcode(), errmsg, ERROR, fb(), INTERVAL_NOT_FINITE, IS_VALID_TIMESTAMP, pg_add_s64_overflow(), PG_GETARG_INTERVAL_P, PG_GETARG_TIMESTAMP, pg_mul_s64_overflow(), PG_RETURN_TIMESTAMP, pg_sub_s64_overflow(), result, TIMESTAMP_NOT_FINITE, unlikely, and USECS_PER_DAY.
| Datum timestamp_cmp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2282 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_RETURN_INT32, and timestamp_cmp_internal().
Referenced by compareDatetime(), gbt_ts_ssup_cmp(), and gbt_tskey_cmp().
Definition at line 2222 of file timestamp.c.
References fb().
Referenced by date_cmp_timestamp_internal(), generate_series_timestamp(), generate_series_timestamptz_internal(), timestamp_cmp(), timestamp_eq(), timestamp_ge(), timestamp_gt(), timestamp_larger(), timestamp_le(), timestamp_lt(), timestamp_ne(), and timestamp_smaller().
| Datum timestamp_cmp_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2453 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_INT32, and timestamp_cmp_timestamptz_internal().
| int32 timestamp_cmp_timestamptz_internal | ( | Timestamp | timestampVal, |
| TimestampTz | dt2 | ||
| ) |
Definition at line 2375 of file timestamp.c.
References ErrorSaveContext::error_occurred, fb(), timestamp2timestamptz_safe(), TIMESTAMP_IS_NOBEGIN, TIMESTAMP_IS_NOEND, and timestamptz_cmp_internal.
Referenced by cmpTimestampToTimestampTz(), timestamp_cmp_timestamptz(), timestamp_eq_timestamptz(), timestamp_ge_timestamptz(), timestamp_gt_timestamptz(), timestamp_le_timestamptz(), timestamp_lt_timestamptz(), timestamp_ne_timestamptz(), timestamptz_cmp_timestamp(), timestamptz_eq_timestamp(), timestamptz_ge_timestamp(), timestamptz_gt_timestamp(), timestamptz_le_timestamp(), timestamptz_lt_timestamp(), and timestamptz_ne_timestamp().
Definition at line 2301 of file timestamp.c.
References DatumGetTimestamp(), fb(), PG_INT64_MIN, and TimestampGetDatum().
Referenced by timestamp_skipsupport().
| Datum timestamp_eq | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2228 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_RETURN_BOOL, and timestamp_cmp_internal().
Referenced by gbt_tseq().
| Datum timestamp_eq_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2399 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_BOOL, and timestamp_cmp_timestamptz_internal().
| Datum timestamp_finite | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2159 of file timestamp.c.
References PG_GETARG_TIMESTAMP, PG_RETURN_BOOL, and TIMESTAMP_NOT_FINITE.
| Datum timestamp_ge | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2273 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_RETURN_BOOL, and timestamp_cmp_internal().
Referenced by gbt_tsge().
| Datum timestamp_ge_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2444 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_BOOL, and timestamp_cmp_timestamptz_internal().
| Datum timestamp_gt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2255 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_RETURN_BOOL, and timestamp_cmp_internal().
Referenced by gbt_tsgt().
| Datum timestamp_gt_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2426 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_BOOL, and timestamp_cmp_timestamptz_internal().
| Datum timestamp_hash | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2347 of file timestamp.c.
References hashint8().
| Datum timestamp_hash_extended | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2353 of file timestamp.c.
References hashint8extended().
| Datum timestamp_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 158 of file timestamp.c.
References AdjustTimestampForTypmod(), DateTimeParseError(), DecodeDateTime(), DTK_DATE, DTK_EARLY, DTK_EPOCH, DTK_LATE, elog, ereturn, errcode(), errmsg, ERROR, fb(), MAXDATEFIELDS, MAXDATELEN, ParseDateTime(), PG_GETARG_CSTRING, PG_GETARG_INT32, PG_GETARG_OID, PG_RETURN_NULL, PG_RETURN_TIMESTAMP, result, SetEpochTimestamp(), str, TIMESTAMP_NOBEGIN, TIMESTAMP_NOEND, tm, and tm2timestamp().
Referenced by moddatetime().
Definition at line 2318 of file timestamp.c.
References DatumGetTimestamp(), fb(), PG_INT64_MAX, and TimestampGetDatum().
Referenced by timestamp_skipsupport().
| Datum timestamp_izone | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6411 of file timestamp.c.
References DatumGetCString(), DirectFunctionCall1, dt2local(), ereport, errcode(), errmsg, ERROR, fb(), INTERVAL_NOT_FINITE, interval_out(), IS_VALID_TIMESTAMP, PG_GETARG_INTERVAL_P, PG_GETARG_TIMESTAMP, PG_RETURN_TIMESTAMPTZ, PointerGetDatum, result, TIMESTAMP_NOT_FINITE, and USECS_PER_SEC.
| Datum timestamp_larger | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2825 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_RETURN_TIMESTAMP, result, and timestamp_cmp_internal().
| Datum timestamp_le | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2264 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_RETURN_BOOL, and timestamp_cmp_internal().
Referenced by gbt_tsle().
| Datum timestamp_le_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2435 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_BOOL, and timestamp_cmp_timestamptz_internal().
| Datum timestamp_lt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2246 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_RETURN_BOOL, and timestamp_cmp_internal().
Referenced by gbt_tslt().
| Datum timestamp_lt_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2417 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_BOOL, and timestamp_cmp_timestamptz_internal().
| Datum timestamp_mi | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2840 of file timestamp.c.
References DatumGetIntervalP(), DirectFunctionCall1, ereport, errcode(), errmsg, ERROR, fb(), interval_justify_hours(), INTERVAL_NOBEGIN, INTERVAL_NOEND, IntervalPGetDatum(), palloc_object, PG_GETARG_TIMESTAMP, PG_RETURN_INTERVAL_P, pg_sub_s64_overflow(), result, TIMESTAMP_IS_NOBEGIN, TIMESTAMP_IS_NOEND, TIMESTAMP_NOT_FINITE, and unlikely.
Referenced by gbt_ts_dist(), generate_series_timestamp_support(), ts_dist(), and tstz_dist().
| Datum timestamp_mi_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3221 of file timestamp.c.
References DirectFunctionCall2, fb(), interval_um_internal(), PG_GETARG_INTERVAL_P, PG_GETARG_TIMESTAMP, PointerGetDatum, timestamp_pl_interval(), and TimestampGetDatum().
Referenced by date_mi_interval(), and in_range_timestamp_interval().
| Datum timestamp_ne | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2237 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_RETURN_BOOL, and timestamp_cmp_internal().
| Datum timestamp_ne_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2408 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_BOOL, and timestamp_cmp_timestamptz_internal().
| Datum timestamp_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 227 of file timestamp.c.
References buf, DateStyle, EncodeDateTime(), EncodeSpecialTimestamp(), ereport, errcode(), errmsg, ERROR, fb(), MAXDATELEN, PG_GETARG_TIMESTAMP, PG_RETURN_CSTRING, pstrdup(), result, timestamp2tm(), TIMESTAMP_NOT_FINITE, and tm.
Referenced by ExecGetJsonValueItemString().
| Datum timestamp_part | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5773 of file timestamp.c.
References timestamp_part_common().
|
static |
Definition at line 5515 of file timestamp.c.
References CStringGetDatum(), date2isoweek(), date2isoyear(), date2j(), DatumGetNumeric(), DecodeSpecial(), DecodeUnits(), DirectFunctionCall2, DirectFunctionCall3, downcase_truncate_identifier(), DTK_CENTURY, DTK_DAY, DTK_DECADE, DTK_DOW, DTK_DOY, DTK_EPOCH, DTK_HOUR, DTK_ISODOW, DTK_ISOYEAR, DTK_JULIAN, DTK_MICROSEC, DTK_MILLENNIUM, DTK_MILLISEC, DTK_MINUTE, DTK_MONTH, DTK_QUARTER, DTK_SECOND, DTK_TZ, DTK_TZ_HOUR, DTK_TZ_MINUTE, DTK_WEEK, DTK_YEAR, epoch, ereport, errcode(), errmsg, ERROR, fb(), format_type_be(), Int32GetDatum(), int64_div_fast_to_numeric(), int64_to_numeric(), INT64CONST, InvalidOid, j2day(), MINS_PER_HOUR, NonFiniteTimestampTzPart(), numeric_add_safe(), numeric_div_safe(), numeric_in(), numeric_round(), numeric_sub_safe(), NumericGetDatum(), ObjectIdGetDatum(), PG_GETARG_TEXT_PP, PG_GETARG_TIMESTAMP, PG_INT64_MAX, PG_RETURN_FLOAT8, PG_RETURN_NULL, PG_RETURN_NUMERIC, RESERV, result, SECS_PER_DAY, SECS_PER_MINUTE, SetEpochTimestamp(), timestamp2tm(), TIMESTAMP_IS_NOBEGIN, TIMESTAMP_NOT_FINITE, 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, type, UNITS, UNKNOWN_FIELD, val, VARDATA_ANY(), and VARSIZE_ANY_EXHDR().
Referenced by extract_timestamp(), and timestamp_part().
| Datum timestamp_pl_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3104 of file timestamp.c.
References date2j(), day_tab, ereport, errcode(), errmsg, ERROR, fb(), INTERVAL_IS_NOBEGIN, INTERVAL_IS_NOEND, IS_VALID_TIMESTAMP, isleap, j2date(), MONTHS_PER_YEAR, pg_add_s32_overflow(), pg_add_s64_overflow(), PG_GETARG_INTERVAL_P, PG_GETARG_TIMESTAMP, PG_RETURN_TIMESTAMP, result, timestamp2tm(), TIMESTAMP_IS_NOBEGIN, TIMESTAMP_IS_NOEND, TIMESTAMP_NOBEGIN, TIMESTAMP_NOEND, TIMESTAMP_NOT_FINITE, tm, tm2timestamp(), pg_tm::tm_mday, pg_tm::tm_mon, and pg_tm::tm_year.
Referenced by date_pl_interval(), generate_series_timestamp(), in_range_timestamp_interval(), and timestamp_mi_interval().
| Datum timestamp_recv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 253 of file timestamp.c.
References AdjustTimestampForTypmod(), buf, ereport, errcode(), errmsg, ERROR, fb(), IS_VALID_TIMESTAMP, PG_GETARG_INT32, PG_GETARG_OID, PG_GETARG_POINTER, PG_RETURN_TIMESTAMP, pq_getmsgint64(), timestamp2tm(), TIMESTAMP_NOT_FINITE, and tm.
| Datum timestamp_scale | ( | PG_FUNCTION_ARGS | ) |
Definition at line 341 of file timestamp.c.
References AdjustTimestampForTypmod(), PG_GETARG_INT32, PG_GETARG_TIMESTAMP, PG_RETURN_NULL, PG_RETURN_TIMESTAMP, and result.
| Datum timestamp_send | ( | PG_FUNCTION_ARGS | ) |
Definition at line 286 of file timestamp.c.
References buf, PG_GETARG_TIMESTAMP, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), and pq_sendint64().
| Datum timestamp_skipsupport | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2334 of file timestamp.c.
References SkipSupportData::decrement, SkipSupportData::high_elem, SkipSupportData::increment, SkipSupportData::low_elem, PG_GETARG_POINTER, PG_INT64_MAX, PG_INT64_MIN, PG_RETURN_VOID, timestamp_decrement(), timestamp_increment(), and TimestampGetDatum().
| Datum timestamp_smaller | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2810 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_RETURN_TIMESTAMP, result, and timestamp_cmp_internal().
| Datum timestamp_sortsupport | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2291 of file timestamp.c.
References SortSupportData::comparator, PG_GETARG_POINTER, PG_RETURN_VOID, and ssup_datum_signed_cmp().
| Datum timestamp_support | ( | PG_FUNCTION_ARGS | ) |
Definition at line 320 of file timestamp.c.
References fb(), IsA, MAX_TIMESTAMP_PRECISION, PG_GETARG_POINTER, PG_RETURN_POINTER, and TemporalSimplify().
| Datum timestamp_timestamptz | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6470 of file timestamp.c.
References PG_GETARG_TIMESTAMP, PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, result, SOFT_ERROR_OCCURRED, and timestamp2timestamptz_safe().
Referenced by executeDateTimeMethod(), and timestamp_at_local().
| Datum timestamp_trunc | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4682 of file timestamp.c.
References date2isoweek(), DecodeUnits(), downcase_truncate_identifier(), DTK_CENTURY, DTK_DAY, DTK_DECADE, DTK_HOUR, DTK_MICROSEC, DTK_MILLENNIUM, DTK_MILLISEC, DTK_MINUTE, DTK_MONTH, DTK_QUARTER, DTK_SECOND, DTK_WEEK, DTK_YEAR, ereport, errcode(), errmsg, ERROR, fb(), format_type_be(), isoweek2date(), MONTHS_PER_YEAR, pg_fallthrough, PG_GETARG_TEXT_PP, PG_GETARG_TIMESTAMP, PG_RETURN_TIMESTAMP, result, timestamp2tm(), TIMESTAMP_NOT_FINITE, tm, tm2timestamp(), pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, pg_tm::tm_year, type, UNITS, val, VARDATA_ANY(), and VARSIZE_ANY_EXHDR().
| Datum timestamp_zone | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6345 of file timestamp.c.
References DecodeTimezoneName(), DetermineTimeZoneAbbrevOffset(), DetermineTimeZoneOffset(), dt2local(), ereport, errcode(), errmsg, ERROR, fb(), IS_VALID_TIMESTAMP, PG_GETARG_TEXT_PP, PG_GETARG_TIMESTAMP, PG_RETURN_TIMESTAMPTZ, result, text_to_cstring_buffer(), timestamp2tm(), TIMESTAMP_NOT_FINITE, tm, tm2timestamp(), type, TZ_STRLEN_MAX, TZNAME_DYNTZ, TZNAME_FIXED_OFFSET, and val.
| void TimestampDifference | ( | TimestampTz | start_time, |
| TimestampTz | stop_time, | ||
| long * | secs, | ||
| int * | microsecs | ||
| ) |
Definition at line 1729 of file timestamp.c.
References fb(), start_time, and USECS_PER_SEC.
Referenced by check_log_duration(), has_startup_progress_timeout_expired(), heap_vacuum_rel(), InvalidatePossiblyObsoleteSlot(), launcher_determine_sleep(), log_disconnections(), LogRecoveryConflict(), pgstat_report_activity(), pgstat_update_dbstats(), ProcSleep(), schedule_alarm(), and TimestampDifferenceExceedsSeconds().
| bool TimestampDifferenceExceeds | ( | TimestampTz | start_time, |
| TimestampTz | stop_time, | ||
| int | msec | ||
| ) |
Definition at line 1789 of file timestamp.c.
References fb(), INT64CONST, and start_time.
Referenced by asyncQueueFillWarning(), AutoVacLauncherMain(), do_analyze_rel(), do_start_worker(), get_candidate_xid(), heap_vacuum_rel(), launch_sync_worker(), LockBufferForCleanup(), logicalrep_worker_launch(), maybe_start_bgworkers(), pa_send_data(), pgstat_report_stat(), ProcSleep(), ResolveRecoveryConflictWithVirtualXIDs(), send_feedback(), should_stop_conflict_info_retention(), update_most_recent_deletion_info(), wait_for_local_flush(), WaitForWALToBecomeAvailable(), WalSndCheckShutdownTimeout(), WalSndLoop(), WalSndUpdateProgress(), WalSndWaitForWal(), and XLogBackgroundFlush().
| bool TimestampDifferenceExceedsSeconds | ( | TimestampTz | start_time, |
| TimestampTz | stop_time, | ||
| int | threshold_sec | ||
| ) |
Definition at line 1803 of file timestamp.c.
References fb(), start_time, and TimestampDifference().
Referenced by DetermineSlotInvalidationCause().
| long TimestampDifferenceMilliseconds | ( | TimestampTz | start_time, |
| TimestampTz | stop_time | ||
| ) |
Definition at line 1765 of file timestamp.c.
References fb(), INT64CONST, pg_sub_s64_overflow(), and start_time.
Referenced by ApplyLauncherMain(), autoprewarm_main(), bbsink_copystream_archive_contents(), DetermineSleepTime(), do_analyze_rel(), GetReplicationApplyDelay(), GetReplicationTransferLatency(), IoWorkerMain(), libpqsrv_cancel(), LogCheckpointEnd(), pg_stash_advice_worker_main(), pgfdw_get_cleanup_result(), pgstat_report_analyze(), pgstat_report_vacuum(), recoveryApplyDelay(), wait_for_local_flush(), WaitForLSN(), WaitForWalSummarization(), WaitForWALToBecomeAvailable(), WalReceiverMain(), and WalSndComputeSleeptime().
Definition at line 6456 of file timestamp.c.
References pg_get_timezone_offset(), and session_timezone.
Referenced by ATColumnChangeRequiresRewrite().
| Datum timestamptypmodin | ( | PG_FUNCTION_ARGS | ) |
Definition at line 297 of file timestamp.c.
References anytimestamp_typmodin(), fb(), PG_GETARG_ARRAYTYPE_P, and PG_RETURN_INT32.
| Datum timestamptypmodout | ( | PG_FUNCTION_ARGS | ) |
Definition at line 305 of file timestamp.c.
References anytimestamp_typmodout(), PG_GETARG_INT32, and PG_RETURN_CSTRING.
|
static |
Definition at line 6555 of file timestamp.c.
References fb(), and timestamptz2timestamp_safe().
Referenced by GetSQLLocalTimestamp().
| Timestamp timestamptz2timestamp_safe | ( | TimestampTz | timestamp, |
| Node * | escontext | ||
| ) |
Definition at line 6571 of file timestamp.c.
References ereturn, errcode(), errmsg, fb(), result, timestamp2tm(), TIMESTAMP_NOBEGIN, TIMESTAMP_NOEND, TIMESTAMP_NOT_FINITE, tm, and tm2timestamp().
Referenced by cvt_timestamptz_timestamp(), timestamptz2timestamp(), and timestamptz_timestamp().
| Datum timestamptz_age | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4455 of file timestamp.c.
References day_tab, ereport, errcode(), errmsg, ERROR, fb(), HOURS_PER_DAY, INTERVAL_NOBEGIN, INTERVAL_NOEND, isleap, itm2interval(), MINS_PER_HOUR, MONTHS_PER_YEAR, palloc_object, PG_GETARG_TIMESTAMPTZ, PG_RETURN_INTERVAL_P, result, SECS_PER_MINUTE, timestamp2tm(), TIMESTAMP_IS_NOBEGIN, TIMESTAMP_IS_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, and USECS_PER_SEC.
| Datum timestamptz_at_local | ( | PG_FUNCTION_ARGS | ) |
| Datum timestamptz_bin | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4847 of file timestamp.c.
References ereport, errcode(), errmsg, ERROR, fb(), INTERVAL_NOT_FINITE, IS_VALID_TIMESTAMP, pg_add_s64_overflow(), PG_GETARG_INTERVAL_P, PG_GETARG_TIMESTAMPTZ, pg_mul_s64_overflow(), PG_RETURN_TIMESTAMPTZ, pg_sub_s64_overflow(), result, TIMESTAMP_NOT_FINITE, unlikely, and USECS_PER_DAY.
| Datum timestamptz_cmp_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2516 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_INT32, and timestamp_cmp_timestamptz_internal().
| Datum timestamptz_eq_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2462 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_BOOL, and timestamp_cmp_timestamptz_internal().
| Datum timestamptz_ge_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2507 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_BOOL, and timestamp_cmp_timestamptz_internal().
| Datum timestamptz_gt_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2489 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_BOOL, and timestamp_cmp_timestamptz_internal().
| Datum timestamptz_hash | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2359 of file timestamp.c.
References hashint8().
| Datum timestamptz_hash_extended | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2365 of file timestamp.c.
References hashint8extended().
| Datum timestamptz_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 414 of file timestamp.c.
References AdjustTimestampForTypmod(), DateTimeParseError(), DecodeDateTime(), DTK_DATE, DTK_EARLY, DTK_EPOCH, DTK_LATE, elog, ereturn, errcode(), errmsg, ERROR, fb(), MAXDATEFIELDS, MAXDATELEN, ParseDateTime(), PG_GETARG_CSTRING, PG_GETARG_INT32, PG_GETARG_OID, PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, result, SetEpochTimestamp(), str, TIMESTAMP_NOBEGIN, TIMESTAMP_NOEND, tm, and tm2timestamp().
Referenced by AlterRole(), CreateRole(), moddatetime(), and validateRecoveryParameters().
| Datum timestamptz_izone | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6680 of file timestamp.c.
References DatumGetCString(), DirectFunctionCall1, dt2local(), ereport, errcode(), errmsg, ERROR, fb(), INTERVAL_NOT_FINITE, interval_out(), IS_VALID_TIMESTAMP, PG_GETARG_INTERVAL_P, PG_GETARG_TIMESTAMPTZ, PG_RETURN_TIMESTAMP, PointerGetDatum, result, TIMESTAMP_NOT_FINITE, and USECS_PER_SEC.
| Datum timestamptz_le_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2498 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_BOOL, and timestamp_cmp_timestamptz_internal().
| Datum timestamptz_lt_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2480 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_BOOL, and timestamp_cmp_timestamptz_internal().
| Datum timestamptz_mi_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3406 of file timestamp.c.
References fb(), PG_GETARG_INTERVAL_P, PG_GETARG_TIMESTAMPTZ, PG_RETURN_TIMESTAMP, and timestamptz_mi_interval_internal().
| Datum timestamptz_mi_interval_at_zone | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3430 of file timestamp.c.
References fb(), lookup_timezone(), PG_GETARG_INTERVAL_P, PG_GETARG_TEXT_PP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_TIMESTAMP, and timestamptz_mi_interval_internal().
|
static |
Definition at line 3381 of file timestamp.c.
References fb(), interval_um_internal(), and timestamptz_pl_interval_internal().
Referenced by in_range_timestamptz_interval(), timestamptz_mi_interval(), and timestamptz_mi_interval_at_zone().
| Datum timestamptz_ne_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2471 of file timestamp.c.
References fb(), PG_GETARG_TIMESTAMP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_BOOL, and timestamp_cmp_timestamptz_internal().
| Datum timestamptz_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 773 of file timestamp.c.
References buf, DateStyle, EncodeDateTime(), EncodeSpecialTimestamp(), ereport, errcode(), errmsg, ERROR, fb(), MAXDATELEN, PG_GETARG_TIMESTAMPTZ, PG_RETURN_CSTRING, pstrdup(), result, timestamp2tm(), TIMESTAMP_NOT_FINITE, and tm.
Referenced by ExecGetJsonValueItemString().
| Datum timestamptz_part | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6046 of file timestamp.c.
References timestamptz_part_common().
|
static |
Definition at line 5789 of file timestamp.c.
References CStringGetDatum(), date2isoweek(), date2isoyear(), date2j(), DatumGetNumeric(), DecodeSpecial(), DecodeUnits(), DirectFunctionCall2, DirectFunctionCall3, downcase_truncate_identifier(), DTK_CENTURY, DTK_DAY, DTK_DECADE, DTK_DOW, DTK_DOY, DTK_EPOCH, DTK_HOUR, DTK_ISODOW, DTK_ISOYEAR, DTK_JULIAN, DTK_MICROSEC, DTK_MILLENNIUM, DTK_MILLISEC, DTK_MINUTE, DTK_MONTH, DTK_QUARTER, DTK_SECOND, DTK_TZ, DTK_TZ_HOUR, DTK_TZ_MINUTE, DTK_WEEK, DTK_YEAR, epoch, ereport, errcode(), errmsg, ERROR, fb(), format_type_be(), Int32GetDatum(), int64_div_fast_to_numeric(), int64_to_numeric(), INT64CONST, InvalidOid, j2day(), MINS_PER_HOUR, NonFiniteTimestampTzPart(), numeric_add_safe(), numeric_div_safe(), numeric_in(), numeric_round(), numeric_sub_safe(), NumericGetDatum(), ObjectIdGetDatum(), PG_GETARG_TEXT_PP, PG_GETARG_TIMESTAMPTZ, PG_INT64_MAX, PG_RETURN_FLOAT8, PG_RETURN_NULL, PG_RETURN_NUMERIC, RESERV, result, SECS_PER_DAY, SECS_PER_HOUR, SECS_PER_MINUTE, SetEpochTimestamp(), timestamp2tm(), TIMESTAMP_IS_NOBEGIN, TIMESTAMP_NOT_FINITE, 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, type, UNITS, UNKNOWN_FIELD, val, VARDATA_ANY(), and VARSIZE_ANY_EXHDR().
Referenced by extract_timestamptz(), and timestamptz_part().
| Datum timestamptz_pl_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3397 of file timestamp.c.
References fb(), PG_GETARG_INTERVAL_P, PG_GETARG_TIMESTAMPTZ, PG_RETURN_TIMESTAMP, and timestamptz_pl_interval_internal().
Referenced by uuidv7_interval().
| Datum timestamptz_pl_interval_at_zone | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3419 of file timestamp.c.
References fb(), lookup_timezone(), PG_GETARG_INTERVAL_P, PG_GETARG_TEXT_PP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_TIMESTAMP, and timestamptz_pl_interval_internal().
|
static |
Definition at line 3248 of file timestamp.c.
References date2j(), day_tab, DetermineTimeZoneOffset(), ereport, errcode(), errmsg, ERROR, fb(), INTERVAL_IS_NOBEGIN, INTERVAL_IS_NOEND, IS_VALID_TIMESTAMP, isleap, j2date(), MONTHS_PER_YEAR, pg_add_s32_overflow(), pg_add_s64_overflow(), result, session_timezone, timestamp2tm(), TIMESTAMP_IS_NOBEGIN, TIMESTAMP_IS_NOEND, TIMESTAMP_NOBEGIN, TIMESTAMP_NOEND, TIMESTAMP_NOT_FINITE, tm, tm2timestamp(), pg_tm::tm_mday, pg_tm::tm_mon, and pg_tm::tm_year.
Referenced by generate_series_timestamptz_internal(), in_range_timestamptz_interval(), timestamptz_mi_interval_internal(), timestamptz_pl_interval(), and timestamptz_pl_interval_at_zone().
| Datum timestamptz_recv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 801 of file timestamp.c.
References AdjustTimestampForTypmod(), buf, ereport, errcode(), errmsg, ERROR, fb(), IS_VALID_TIMESTAMP, PG_GETARG_INT32, PG_GETARG_OID, PG_GETARG_POINTER, PG_RETURN_TIMESTAMPTZ, pq_getmsgint64(), timestamp2tm(), TIMESTAMP_NOT_FINITE, and tm.
| Datum timestamptz_scale | ( | PG_FUNCTION_ARGS | ) |
Definition at line 868 of file timestamp.c.
References AdjustTimestampForTypmod(), PG_GETARG_INT32, PG_GETARG_TIMESTAMPTZ, PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, and result.
| Datum timestamptz_send | ( | PG_FUNCTION_ARGS | ) |
Definition at line 835 of file timestamp.c.
References buf, PG_GETARG_TIMESTAMPTZ, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), and pq_sendint64().
| Datum timestamptz_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6539 of file timestamp.c.
References PG_GETARG_TIMESTAMPTZ, PG_RETURN_NULL, PG_RETURN_TIMESTAMP, result, SOFT_ERROR_OCCURRED, timestamptz2timestamp_safe(), and unlikely.
Referenced by executeDateTimeMethod(), and timestamptz_at_local().
| const char * timestamptz_to_str | ( | TimestampTz | t | ) |
Definition at line 1870 of file timestamp.c.
References buf, EncodeDateTime(), EncodeSpecialTimestamp(), fb(), MAXDATELEN, strlcpy(), timestamp2tm(), TIMESTAMP_NOT_FINITE, tm, and USE_ISO_DATES.
Referenced by CreateRestartPoint(), errdetail_apply_conflict(), getRecoveryStopReason(), InitWalRecovery(), PerformWalRecovery(), pg_decode_commit_prepared_txn(), pg_decode_commit_txn(), pg_decode_prepare_txn(), pg_decode_rollback_prepared_txn(), pg_decode_stream_commit(), pg_decode_stream_prepare(), ProcessStandbyHSFeedbackMessage(), ProcessStandbyReplyMessage(), ProcessWalSndrMessage(), recoveryStopsAfter(), recoveryStopsBefore(), xact_desc_abort(), xact_desc_commit(), xact_desc_prepare(), xlog_desc(), and xlogrecovery_redo().
| pg_time_t timestamptz_to_time_t | ( | TimestampTz | t | ) |
Definition at line 1850 of file timestamp.c.
References POSTGRES_EPOCH_JDATE, result, SECS_PER_DAY, UNIX_EPOCH_JDATE, and USECS_PER_SEC.
Referenced by DetermineTimeZoneAbbrevOffsetTS(), InitProcessGlobals(), and pg_timezone_abbrevs_zone().
| Datum timestamptz_trunc | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5100 of file timestamp.c.
References fb(), PG_GETARG_TEXT_PP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_TIMESTAMPTZ, result, session_timezone, and timestamptz_trunc_internal().
|
static |
Definition at line 4921 of file timestamp.c.
References date2isoweek(), DecodeUnits(), DetermineTimeZoneOffset(), downcase_truncate_identifier(), DTK_CENTURY, DTK_DAY, DTK_DECADE, DTK_HOUR, DTK_MICROSEC, DTK_MILLENNIUM, DTK_MILLISEC, DTK_MINUTE, DTK_MONTH, DTK_QUARTER, DTK_SECOND, DTK_WEEK, DTK_YEAR, ereport, errcode(), errmsg, ERROR, fb(), format_type_be(), isoweek2date(), MONTHS_PER_YEAR, pg_fallthrough, result, timestamp2tm(), TIMESTAMP_NOT_FINITE, tm, tm2timestamp(), pg_tm::tm_hour, pg_tm::tm_mday, pg_tm::tm_min, pg_tm::tm_mon, pg_tm::tm_sec, pg_tm::tm_year, type, UNITS, val, VARDATA_ANY(), and VARSIZE_ANY_EXHDR().
Referenced by timestamptz_trunc(), and timestamptz_trunc_zone().
| Datum timestamptz_trunc_zone | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5116 of file timestamp.c.
References fb(), lookup_timezone(), PG_GETARG_TEXT_PP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_TIMESTAMPTZ, result, and timestamptz_trunc_internal().
| Datum timestamptz_zone | ( | PG_FUNCTION_ARGS | ) |
Definition at line 6615 of file timestamp.c.
References DecodeTimezoneName(), DetermineTimeZoneAbbrevOffsetTS(), dt2local(), ereport, errcode(), errmsg, ERROR, fb(), IS_VALID_TIMESTAMP, PG_GETARG_TEXT_PP, PG_GETARG_TIMESTAMPTZ, PG_RETURN_TIMESTAMP, result, text_to_cstring_buffer(), timestamp2tm(), TIMESTAMP_NOT_FINITE, tm, tm2timestamp(), type, TZ_STRLEN_MAX, TZNAME_DYNTZ, TZNAME_FIXED_OFFSET, and val.
| Datum timestamptztypmodin | ( | PG_FUNCTION_ARGS | ) |
Definition at line 846 of file timestamp.c.
References anytimestamp_typmodin(), fb(), PG_GETARG_ARRAYTYPE_P, and PG_RETURN_INT32.
| Datum timestamptztypmodout | ( | PG_FUNCTION_ARGS | ) |
Definition at line 854 of file timestamp.c.
References anytimestamp_typmodout(), PG_GETARG_INT32, and PG_RETURN_CSTRING.
Definition at line 2015 of file timestamp.c.
References date2j(), dt2local(), fb(), IS_VALID_JULIAN, IS_VALID_TIMESTAMP, pg_add_s64_overflow(), pg_mul_s64_overflow(), POSTGRES_EPOCH_JDATE, result, time2t(), 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, unlikely, and USECS_PER_DAY.
Referenced by check_recovery_target_time(), parse_datetime(), PGTYPEStimestamp_add_interval(), PGTYPEStimestamp_current(), PGTYPEStimestamp_defmt_scan(), PGTYPEStimestamp_from_asc(), SetEpochTimestamp(), SetEpochTimestamp(), timestamp_in(), timestamp_pl_interval(), timestamp_trunc(), timestamp_zone(), timestamptz2timestamp_safe(), timestamptz_in(), timestamptz_pl_interval_internal(), timestamptz_trunc_internal(), timestamptz_zone(), and to_timestamp().
| TimestampTz PgReloadTime |
Definition at line 48 of file timestamp.c.
Referenced by pg_conf_load_time(), and ProcessConfigFileInternal().
| TimestampTz PgStartTime |
Definition at line 45 of file timestamp.c.
Referenced by pg_postmaster_start_time(), PostgresSingleUserMain(), and PostmasterMain().