31#define uuid_hash bsd_uuid_hash
33#if defined(HAVE_UUID_H)
35#elif defined(HAVE_OSSP_UUID_H)
37#elif defined(HAVE_UUID_UUID_H)
40#error "please use configure's --with-uuid switch to select a UUID library"
46#if defined(HAVE_UUID_OSSP) && (UUID_LEN != UUID_LEN_BIN)
47#error UUID length mismatch
75#define dce_uuid_t uuid_t
81#define UUID_TO_NETWORK(uu) \
83 uu.time_low = pg_hton32(uu.time_low); \
84 uu.time_mid = pg_hton16(uu.time_mid); \
85 uu.time_hi_and_version = pg_hton16(uu.time_hi_and_version); \
88#define UUID_TO_LOCAL(uu) \
90 uu.time_low = pg_ntoh32(uu.time_low); \
91 uu.time_mid = pg_ntoh16(uu.time_mid); \
92 uu.time_hi_and_version = pg_ntoh16(uu.time_hi_and_version); \
95#define UUID_V3_OR_V5(uu, v) \
97 uu.time_hi_and_version &= 0x0FFF; \
98 uu.time_hi_and_version |= (v << 12); \
99 uu.clock_seq_hi_and_reserved &= 0x3F; \
100 uu.clock_seq_hi_and_reserved |= 0x80; \
132 errmsg(
"OSSP uuid library failure: %s",
err)));
136 errmsg(
"OSSP uuid library failure: error code %d", rc)));
275 if (ptr &&
len <= 36)
300 errmsg(
"uuid_create() produced a version %c UUID instead of the expected version 1",
308 if (ptr &&
len <= 36)
317 errmsg(
"uuid library failure: %d",
337 elog(
ERROR,
"could not initialize %s context: %s",
"MD5",
341 elog(
ERROR,
"could not update %s context: %s",
"MD5",
346 elog(
ERROR,
"could not finalize %s context: %s",
"MD5",
356 elog(
ERROR,
"could not initialize %s context: %s",
"SHA1",
360 elog(
ERROR,
"could not update %s context: %s",
"SHA1",
363 elog(
ERROR,
"could not finalize %s context: %s",
"SHA1",
389 errmsg(
"uuid library failure: %d",
405 "%08lx-%04x-%04x-%04x-%04x%08lx",
409 (
unsigned) ((
arc4random() & 0x3fff) | 0x8000),
430 "00000000-0000-0000-0000-000000000000", 36);
442 "6ba7b810-9dad-11d1-80b4-00c04fd430c8", 36);
454 "6ba7b811-9dad-11d1-80b4-00c04fd430c8", 36);
466 "6ba7b812-9dad-11d1-80b4-00c04fd430c8", 36);
478 "6ba7b814-9dad-11d1-80b4-00c04fd430c8", 36);
495#elif defined(HAVE_UUID_E2FS)
512 (
unsigned) ((
arc4random() & 0xffff) | 0x0300),
const char * pg_cryptohash_error(pg_cryptohash_ctx *ctx)
int pg_cryptohash_update(pg_cryptohash_ctx *ctx, const uint8 *data, size_t len)
pg_cryptohash_ctx * pg_cryptohash_create(pg_cryptohash_type type)
int pg_cryptohash_init(pg_cryptohash_ctx *ctx)
void pg_cryptohash_free(pg_cryptohash_ctx *ctx)
int pg_cryptohash_final(pg_cryptohash_ctx *ctx, uint8 *dest, size_t len)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void err(int eval, const char *fmt,...)
#define PG_GETARG_TEXT_PP(n)
#define PG_MODULE_MAGIC_EXT(...)
#define DirectFunctionCall1(func, arg1)
#define PG_FUNCTION_INFO_V1(funcname)
static PgChecksumMode mode
static char buf[DEFAULT_XLOG_SEG_SIZE]
size_t strlcpy(char *dst, const char *src, size_t siz)
static char * DatumGetCString(Datum X)
static Datum CStringGetDatum(const char *X)
#define SHA1_DIGEST_LENGTH
Datum uuid_ns_oid(PG_FUNCTION_ARGS)
Datum uuid_ns_dns(PG_FUNCTION_ARGS)
Datum uuid_nil(PG_FUNCTION_ARGS)
Datum uuid_ns_url(PG_FUNCTION_ARGS)
Datum uuid_generate_v1mc(PG_FUNCTION_ARGS)
Datum uuid_generate_v4(PG_FUNCTION_ARGS)
Datum uuid_generate_v5(PG_FUNCTION_ARGS)
#define UUID_V3_OR_V5(uu, v)
Datum uuid_ns_x500(PG_FUNCTION_ARGS)
Datum uuid_generate_v1(PG_FUNCTION_ARGS)
static Datum uuid_generate_internal(int v, unsigned char *ns, const char *ptr, int len)
#define UUID_TO_LOCAL(uu)
#define UUID_TO_NETWORK(uu)
Datum uuid_generate_v3(PG_FUNCTION_ARGS)
static void string_to_uuid(const char *source, pg_uuid_t *uuid, Node *escontext)
Datum uuid_out(PG_FUNCTION_ARGS)
Datum uuid_in(PG_FUNCTION_ARGS)
static Datum UUIDPGetDatum(const pg_uuid_t *X)
#define PG_GETARG_UUID_P(X)
static Size VARSIZE_ANY_EXHDR(const void *PTR)
static char * VARDATA_ANY(const void *PTR)
char * text_to_cstring(const text *t)