PostgreSQL Source Code git master
|
#include "postgres.h"
#include <time.h>
#include "common/hashfn.h"
#include "lib/hyperloglog.h"
#include "libpq/pqformat.h"
#include "port/pg_bswap.h"
#include "utils/fmgrprotos.h"
#include "utils/guc.h"
#include "utils/sortsupport.h"
#include "utils/timestamp.h"
#include "utils/uuid.h"
Go to the source code of this file.
Data Structures | |
struct | uuid_sortsupport_state |
Macros | |
#define | NS_PER_S INT64CONST(1000000000) |
#define | NS_PER_MS INT64CONST(1000000) |
#define | NS_PER_US INT64CONST(1000) |
#define | SUBMS_MINIMAL_STEP_BITS 12 |
#define | SUBMS_BITS 12 |
#define | SUBMS_MINIMAL_STEP_NS ((NS_PER_MS / (1 << SUBMS_MINIMAL_STEP_BITS)) + 1) |
#define | GREGORIAN_EPOCH_JDATE INT64CONST(2299161) |
#define GREGORIAN_EPOCH_JDATE INT64CONST(2299161) |
#define NS_PER_MS INT64CONST(1000000) |
#define NS_PER_S INT64CONST(1000000000) |
#define NS_PER_US INT64CONST(1000) |
#define SUBMS_MINIMAL_STEP_NS ((NS_PER_MS / (1 << SUBMS_MINIMAL_STEP_BITS)) + 1) |
Datum gen_random_uuid | ( | PG_FUNCTION_ARGS | ) |
Definition at line 456 of file uuid.c.
References ereport, errcode(), errmsg(), ERROR, palloc(), PG_RETURN_UUID_P, pg_strong_random(), UUID_LEN, and uuid_set_version().
Referenced by pg_random_uuid().
Definition at line 530 of file uuid.c.
References pg_uuid_t::data, ereport, errcode(), errmsg(), ERROR, NS_PER_MS, palloc(), pg_strong_random(), SUBMS_BITS, UUID_LEN, and uuid_set_version().
Referenced by uuidv7(), and uuidv7_interval().
|
inlinestatic |
Definition at line 480 of file uuid.c.
References gettimeofday(), NS_PER_S, NS_PER_US, and SUBMS_MINIMAL_STEP_NS.
Referenced by uuidv7(), and uuidv7_interval().
Definition at line 127 of file uuid.c.
References pg_uuid_t::data, ereturn, errcode(), errmsg(), i, source, syntax_error(), and UUID_LEN.
Referenced by uuid_in().
|
static |
Definition at line 324 of file uuid.c.
References uuid_sortsupport_state::abbr_card, elog, estimateHyperLogLog(), uuid_sortsupport_state::estimating, uuid_sortsupport_state::input_count, INT64_FORMAT, LOG, SortSupportData::ssup_extra, and trace_sort.
Referenced by uuid_sortsupport().
|
static |
Definition at line 384 of file uuid.c.
References uuid_sortsupport_state::abbr_card, addHyperLogLog(), pg_uuid_t::data, DatumGetUInt32(), DatumGetUUIDP(), uuid_sortsupport_state::estimating, hash_uint32(), uuid_sortsupport_state::input_count, res, and SortSupportData::ssup_extra.
Referenced by uuid_sortsupport().
Datum uuid_cmp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 261 of file uuid.c.
References PG_GETARG_UUID_P, PG_RETURN_INT32, and uuid_internal_cmp().
Datum uuid_eq | ( | PG_FUNCTION_ARGS | ) |
Definition at line 224 of file uuid.c.
References PG_GETARG_UUID_P, PG_RETURN_BOOL, and uuid_internal_cmp().
Datum uuid_extract_timestamp | ( | PG_FUNCTION_ARGS | ) |
Definition at line 645 of file uuid.c.
References pg_uuid_t::data, GREGORIAN_EPOCH_JDATE, NS_PER_US, PG_GETARG_UUID_P, PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, POSTGRES_EPOCH_JDATE, SECS_PER_DAY, UNIX_EPOCH_JDATE, and USECS_PER_SEC.
Datum uuid_extract_version | ( | PG_FUNCTION_ARGS | ) |
Definition at line 701 of file uuid.c.
References pg_uuid_t::data, PG_GETARG_UUID_P, PG_RETURN_NULL, and PG_RETURN_UINT16.
|
static |
Definition at line 309 of file uuid.c.
References DatumGetUUIDP(), uuid_internal_cmp(), x, and y.
Referenced by uuid_sortsupport().
Datum uuid_ge | ( | PG_FUNCTION_ARGS | ) |
Definition at line 233 of file uuid.c.
References PG_GETARG_UUID_P, PG_RETURN_BOOL, and uuid_internal_cmp().
Datum uuid_gt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 242 of file uuid.c.
References PG_GETARG_UUID_P, PG_RETURN_BOOL, and uuid_internal_cmp().
Datum uuid_hash | ( | PG_FUNCTION_ARGS | ) |
Definition at line 421 of file uuid.c.
References hash_any(), sort-test::key, PG_GETARG_UUID_P, and UUID_LEN.
Datum uuid_hash_extended | ( | PG_FUNCTION_ARGS | ) |
Definition at line 429 of file uuid.c.
References hash_any_extended(), sort-test::key, PG_GETARG_INT64, PG_GETARG_UUID_P, and UUID_LEN.
Datum uuid_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 74 of file uuid.c.
References palloc(), PG_GETARG_CSTRING, PG_RETURN_UUID_P, and string_to_uuid().
Referenced by uuid_generate_internal().
Definition at line 200 of file uuid.c.
References pg_uuid_t::data, and UUID_LEN.
Referenced by uuid_cmp(), uuid_eq(), uuid_fast_cmp(), uuid_ge(), uuid_gt(), uuid_le(), uuid_lt(), and uuid_ne().
Datum uuid_le | ( | PG_FUNCTION_ARGS | ) |
Definition at line 215 of file uuid.c.
References PG_GETARG_UUID_P, PG_RETURN_BOOL, and uuid_internal_cmp().
Referenced by brin_minmax_multi_distance_uuid().
Datum uuid_lt | ( | PG_FUNCTION_ARGS | ) |
Definition at line 206 of file uuid.c.
References PG_GETARG_UUID_P, PG_RETURN_BOOL, and uuid_internal_cmp().
Datum uuid_ne | ( | PG_FUNCTION_ARGS | ) |
Definition at line 251 of file uuid.c.
References PG_GETARG_UUID_P, PG_RETURN_BOOL, and uuid_internal_cmp().
Datum uuid_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 85 of file uuid.c.
References buf, pg_uuid_t::data, i, palloc(), PG_GETARG_UUID_P, PG_RETURN_CSTRING, and UUID_LEN.
Datum uuid_recv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 177 of file uuid.c.
References pg_uuid_t::data, palloc(), PG_GETARG_POINTER, PG_RETURN_POINTER, pq_getmsgbytes(), and UUID_LEN.
Datum uuid_send | ( | PG_FUNCTION_ARGS | ) |
Definition at line 188 of file uuid.c.
References pg_uuid_t::data, PG_GETARG_UUID_P, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendbytes(), and UUID_LEN.
|
inlinestatic |
Definition at line 440 of file uuid.c.
References pg_uuid_t::data.
Referenced by gen_random_uuid(), and generate_uuidv7().
Datum uuid_sortsupport | ( | PG_FUNCTION_ARGS | ) |
Definition at line 273 of file uuid.c.
References uuid_sortsupport_state::abbr_card, SortSupportData::abbrev_abort, SortSupportData::abbrev_converter, SortSupportData::abbrev_full_comparator, SortSupportData::abbreviate, SortSupportData::comparator, uuid_sortsupport_state::estimating, initHyperLogLog(), uuid_sortsupport_state::input_count, MemoryContextSwitchTo(), palloc(), PG_GETARG_POINTER, PG_RETURN_VOID, SortSupportData::ssup_cxt, ssup_datum_unsigned_cmp(), SortSupportData::ssup_extra, uuid_abbrev_abort(), uuid_abbrev_convert(), and uuid_fast_cmp().
Datum uuidv7 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 587 of file uuid.c.
References generate_uuidv7(), get_real_time_ns_ascending(), and PG_RETURN_UUID_P.
Datum uuidv7_interval | ( | PG_FUNCTION_ARGS | ) |
Definition at line 598 of file uuid.c.
References DatumGetTimestampTz(), DirectFunctionCall2, generate_uuidv7(), get_real_time_ns_ascending(), IntervalPGetDatum(), NS_PER_US, PG_GETARG_INTERVAL_P, PG_RETURN_UUID_P, POSTGRES_EPOCH_JDATE, SECS_PER_DAY, timestamptz_pl_interval(), TimestampTzGetDatum(), UNIX_EPOCH_JDATE, and USECS_PER_SEC.