PostgreSQL Source Code  git master
uuid.c File Reference
#include "postgres.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"
Include dependency graph for uuid.c:

Go to the source code of this file.

Data Structures

struct  uuid_sortsupport_state
 

Macros

#define UUIDV1_EPOCH_JDATE   2299161 /* == date2j(1582,10,15) */
 

Functions

static void string_to_uuid (const char *source, pg_uuid_t *uuid, Node *escontext)
 
static int uuid_internal_cmp (const pg_uuid_t *arg1, const pg_uuid_t *arg2)
 
static int uuid_fast_cmp (Datum x, Datum y, SortSupport ssup)
 
static bool uuid_abbrev_abort (int memtupcount, SortSupport ssup)
 
static Datum uuid_abbrev_convert (Datum original, SortSupport ssup)
 
Datum uuid_in (PG_FUNCTION_ARGS)
 
Datum uuid_out (PG_FUNCTION_ARGS)
 
Datum uuid_recv (PG_FUNCTION_ARGS)
 
Datum uuid_send (PG_FUNCTION_ARGS)
 
Datum uuid_lt (PG_FUNCTION_ARGS)
 
Datum uuid_le (PG_FUNCTION_ARGS)
 
Datum uuid_eq (PG_FUNCTION_ARGS)
 
Datum uuid_ge (PG_FUNCTION_ARGS)
 
Datum uuid_gt (PG_FUNCTION_ARGS)
 
Datum uuid_ne (PG_FUNCTION_ARGS)
 
Datum uuid_cmp (PG_FUNCTION_ARGS)
 
Datum uuid_sortsupport (PG_FUNCTION_ARGS)
 
Datum uuid_hash (PG_FUNCTION_ARGS)
 
Datum uuid_hash_extended (PG_FUNCTION_ARGS)
 
Datum gen_random_uuid (PG_FUNCTION_ARGS)
 
Datum uuid_extract_timestamp (PG_FUNCTION_ARGS)
 
Datum uuid_extract_version (PG_FUNCTION_ARGS)
 

Macro Definition Documentation

◆ UUIDV1_EPOCH_JDATE

#define UUIDV1_EPOCH_JDATE   2299161 /* == date2j(1582,10,15) */

Definition at line 430 of file uuid.c.

Function Documentation

◆ gen_random_uuid()

Datum gen_random_uuid ( PG_FUNCTION_ARGS  )

Definition at line 411 of file uuid.c.

412 {
413  pg_uuid_t *uuid = palloc(UUID_LEN);
414 
415  if (!pg_strong_random(uuid, UUID_LEN))
416  ereport(ERROR,
417  (errcode(ERRCODE_INTERNAL_ERROR),
418  errmsg("could not generate random values")));
419 
420  /*
421  * Set magic numbers for a "version 4" (pseudorandom) UUID, see
422  * http://tools.ietf.org/html/rfc4122#section-4.4
423  */
424  uuid->data[6] = (uuid->data[6] & 0x0f) | 0x40; /* time_hi_and_version */
425  uuid->data[8] = (uuid->data[8] & 0x3f) | 0x80; /* clock_seq_hi_and_reserved */
426 
427  PG_RETURN_UUID_P(uuid);
428 }
int errcode(int sqlerrcode)
Definition: elog.c:859
int errmsg(const char *fmt,...)
Definition: elog.c:1072
#define ERROR
Definition: elog.h:39
#define ereport(elevel,...)
Definition: elog.h:149
void * palloc(Size size)
Definition: mcxt.c:1316
bool pg_strong_random(void *buf, size_t len)
Definition: uuid.h:21
unsigned char data[UUID_LEN]
Definition: uuid.h:22
#define PG_RETURN_UUID_P(X)
Definition: uuid.h:32
#define UUID_LEN
Definition: uuid.h:18

References pg_uuid_t::data, ereport, errcode(), errmsg(), ERROR, palloc(), PG_RETURN_UUID_P, pg_strong_random(), and UUID_LEN.

Referenced by pg_random_uuid().

◆ string_to_uuid()

static void string_to_uuid ( const char *  source,
pg_uuid_t uuid,
Node escontext 
)
static

Definition at line 95 of file uuid.c.

96 {
97  const char *src = source;
98  bool braces = false;
99  int i;
100 
101  if (src[0] == '{')
102  {
103  src++;
104  braces = true;
105  }
106 
107  for (i = 0; i < UUID_LEN; i++)
108  {
109  char str_buf[3];
110 
111  if (src[0] == '\0' || src[1] == '\0')
112  goto syntax_error;
113  memcpy(str_buf, src, 2);
114  if (!isxdigit((unsigned char) str_buf[0]) ||
115  !isxdigit((unsigned char) str_buf[1]))
116  goto syntax_error;
117 
118  str_buf[2] = '\0';
119  uuid->data[i] = (unsigned char) strtoul(str_buf, NULL, 16);
120  src += 2;
121  if (src[0] == '-' && (i % 2) == 1 && i < UUID_LEN - 1)
122  src++;
123  }
124 
125  if (braces)
126  {
127  if (*src != '}')
128  goto syntax_error;
129  src++;
130  }
131 
132  if (*src != '\0')
133  goto syntax_error;
134 
135  return;
136 
138  ereturn(escontext,,
139  (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
140  errmsg("invalid input syntax for type %s: \"%s\"",
141  "uuid", source)));
142 }
#define ereturn(context, dummy_value,...)
Definition: elog.h:276
int i
Definition: isn.c:73
static rewind_source * source
Definition: pg_rewind.c:89
void syntax_error(const char *source, int lineno, const char *line, const char *command, const char *msg, const char *more, int column)
Definition: pgbench.c:5477

References pg_uuid_t::data, ereturn, errcode(), errmsg(), i, source, syntax_error(), and UUID_LEN.

Referenced by uuid_in().

◆ uuid_abbrev_abort()

static bool uuid_abbrev_abort ( int  memtupcount,
SortSupport  ssup 
)
static

Definition at line 292 of file uuid.c.

293 {
294  uuid_sortsupport_state *uss = ssup->ssup_extra;
295  double abbr_card;
296 
297  if (memtupcount < 10000 || uss->input_count < 10000 || !uss->estimating)
298  return false;
299 
300  abbr_card = estimateHyperLogLog(&uss->abbr_card);
301 
302  /*
303  * If we have >100k distinct values, then even if we were sorting many
304  * billion rows we'd likely still break even, and the penalty of undoing
305  * that many rows of abbrevs would probably not be worth it. Stop even
306  * counting at that point.
307  */
308  if (abbr_card > 100000.0)
309  {
310 #ifdef TRACE_SORT
311  if (trace_sort)
312  elog(LOG,
313  "uuid_abbrev: estimation ends at cardinality %f"
314  " after " INT64_FORMAT " values (%d rows)",
315  abbr_card, uss->input_count, memtupcount);
316 #endif
317  uss->estimating = false;
318  return false;
319  }
320 
321  /*
322  * Target minimum cardinality is 1 per ~2k of non-null inputs. 0.5 row
323  * fudge factor allows us to abort earlier on genuinely pathological data
324  * where we've had exactly one abbreviated value in the first 2k
325  * (non-null) rows.
326  */
327  if (abbr_card < uss->input_count / 2000.0 + 0.5)
328  {
329 #ifdef TRACE_SORT
330  if (trace_sort)
331  elog(LOG,
332  "uuid_abbrev: aborting abbreviation at cardinality %f"
333  " below threshold %f after " INT64_FORMAT " values (%d rows)",
334  abbr_card, uss->input_count / 2000.0 + 0.5, uss->input_count,
335  memtupcount);
336 #endif
337  return true;
338  }
339 
340 #ifdef TRACE_SORT
341  if (trace_sort)
342  elog(LOG,
343  "uuid_abbrev: cardinality %f after " INT64_FORMAT
344  " values (%d rows)", abbr_card, uss->input_count, memtupcount);
345 #endif
346 
347  return false;
348 }
#define INT64_FORMAT
Definition: c.h:548
#define LOG
Definition: elog.h:31
#define elog(elevel,...)
Definition: elog.h:224
double estimateHyperLogLog(hyperLogLogState *cState)
Definition: hyperloglog.c:186
void * ssup_extra
Definition: sortsupport.h:87
hyperLogLogState abbr_card
Definition: uuid.c:32
bool trace_sort
Definition: tuplesort.c:124

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().

◆ uuid_abbrev_convert()

static Datum uuid_abbrev_convert ( Datum  original,
SortSupport  ssup 
)
static

Definition at line 358 of file uuid.c.

359 {
360  uuid_sortsupport_state *uss = ssup->ssup_extra;
361  pg_uuid_t *authoritative = DatumGetUUIDP(original);
362  Datum res;
363 
364  memcpy(&res, authoritative->data, sizeof(Datum));
365  uss->input_count += 1;
366 
367  if (uss->estimating)
368  {
369  uint32 tmp;
370 
371 #if SIZEOF_DATUM == 8
372  tmp = (uint32) res ^ (uint32) ((uint64) res >> 32);
373 #else /* SIZEOF_DATUM != 8 */
374  tmp = (uint32) res;
375 #endif
376 
378  }
379 
380  /*
381  * Byteswap on little-endian machines.
382  *
383  * This is needed so that ssup_datum_unsigned_cmp() (an unsigned integer
384  * 3-way comparator) works correctly on all platforms. If we didn't do
385  * this, the comparator would have to call memcmp() with a pair of
386  * pointers to the first byte of each abbreviated key, which is slower.
387  */
388  res = DatumBigEndianToNative(res);
389 
390  return res;
391 }
unsigned int uint32
Definition: c.h:506
static Datum hash_uint32(uint32 k)
Definition: hashfn.h:43
void addHyperLogLog(hyperLogLogState *cState, uint32 hash)
Definition: hyperloglog.c:167
static uint32 DatumGetUInt32(Datum X)
Definition: postgres.h:222
uintptr_t Datum
Definition: postgres.h:64
static pg_uuid_t * DatumGetUUIDP(Datum X)
Definition: uuid.h:35

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().

◆ uuid_cmp()

Datum uuid_cmp ( PG_FUNCTION_ARGS  )

Definition at line 229 of file uuid.c.

230 {
231  pg_uuid_t *arg1 = PG_GETARG_UUID_P(0);
232  pg_uuid_t *arg2 = PG_GETARG_UUID_P(1);
233 
234  PG_RETURN_INT32(uuid_internal_cmp(arg1, arg2));
235 }
#define PG_RETURN_INT32(x)
Definition: fmgr.h:354
static int uuid_internal_cmp(const pg_uuid_t *arg1, const pg_uuid_t *arg2)
Definition: uuid.c:168
#define PG_GETARG_UUID_P(X)
Definition: uuid.h:40

References PG_GETARG_UUID_P, PG_RETURN_INT32, and uuid_internal_cmp().

◆ uuid_eq()

Datum uuid_eq ( PG_FUNCTION_ARGS  )

Definition at line 192 of file uuid.c.

193 {
194  pg_uuid_t *arg1 = PG_GETARG_UUID_P(0);
195  pg_uuid_t *arg2 = PG_GETARG_UUID_P(1);
196 
197  PG_RETURN_BOOL(uuid_internal_cmp(arg1, arg2) == 0);
198 }
#define PG_RETURN_BOOL(x)
Definition: fmgr.h:359

References PG_GETARG_UUID_P, PG_RETURN_BOOL, and uuid_internal_cmp().

◆ uuid_extract_timestamp()

Datum uuid_extract_timestamp ( PG_FUNCTION_ARGS  )

Definition at line 438 of file uuid.c.

439 {
440  pg_uuid_t *uuid = PG_GETARG_UUID_P(0);
441  int version;
442  uint64 tms;
443  TimestampTz ts;
444 
445  /* check if RFC 4122 variant */
446  if ((uuid->data[8] & 0xc0) != 0x80)
447  PG_RETURN_NULL();
448 
449  version = uuid->data[6] >> 4;
450 
451  if (version == 1)
452  {
453  tms = ((uint64) uuid->data[0] << 24)
454  + ((uint64) uuid->data[1] << 16)
455  + ((uint64) uuid->data[2] << 8)
456  + ((uint64) uuid->data[3])
457  + ((uint64) uuid->data[4] << 40)
458  + ((uint64) uuid->data[5] << 32)
459  + (((uint64) uuid->data[6] & 0xf) << 56)
460  + ((uint64) uuid->data[7] << 48);
461 
462  /* convert 100-ns intervals to us, then adjust */
463  ts = (TimestampTz) (tms / 10) -
465 
467  }
468 
469  /* not a timestamp-containing UUID version */
470  PG_RETURN_NULL();
471 }
int64 TimestampTz
Definition: timestamp.h:39
#define USECS_PER_SEC
Definition: timestamp.h:134
#define SECS_PER_DAY
Definition: timestamp.h:126
#define POSTGRES_EPOCH_JDATE
Definition: timestamp.h:235
#define PG_RETURN_NULL()
Definition: fmgr.h:345
#define PG_RETURN_TIMESTAMPTZ(x)
Definition: timestamp.h:68
#define UUIDV1_EPOCH_JDATE
Definition: uuid.c:430

References pg_uuid_t::data, PG_GETARG_UUID_P, PG_RETURN_NULL, PG_RETURN_TIMESTAMPTZ, POSTGRES_EPOCH_JDATE, SECS_PER_DAY, USECS_PER_SEC, and UUIDV1_EPOCH_JDATE.

◆ uuid_extract_version()

Datum uuid_extract_version ( PG_FUNCTION_ARGS  )

Definition at line 479 of file uuid.c.

480 {
481  pg_uuid_t *uuid = PG_GETARG_UUID_P(0);
482  uint16 version;
483 
484  /* check if RFC 4122 variant */
485  if ((uuid->data[8] & 0xc0) != 0x80)
486  PG_RETURN_NULL();
487 
488  version = uuid->data[6] >> 4;
489 
490  PG_RETURN_UINT16(version);
491 }
unsigned short uint16
Definition: c.h:505
#define PG_RETURN_UINT16(x)
Definition: fmgr.h:357

References pg_uuid_t::data, PG_GETARG_UUID_P, PG_RETURN_NULL, and PG_RETURN_UINT16.

◆ uuid_fast_cmp()

static int uuid_fast_cmp ( Datum  x,
Datum  y,
SortSupport  ssup 
)
static

Definition at line 277 of file uuid.c.

278 {
279  pg_uuid_t *arg1 = DatumGetUUIDP(x);
280  pg_uuid_t *arg2 = DatumGetUUIDP(y);
281 
282  return uuid_internal_cmp(arg1, arg2);
283 }
int y
Definition: isn.c:72
int x
Definition: isn.c:71

References DatumGetUUIDP(), uuid_internal_cmp(), x, and y.

Referenced by uuid_sortsupport().

◆ uuid_ge()

Datum uuid_ge ( PG_FUNCTION_ARGS  )

Definition at line 201 of file uuid.c.

202 {
203  pg_uuid_t *arg1 = PG_GETARG_UUID_P(0);
204  pg_uuid_t *arg2 = PG_GETARG_UUID_P(1);
205 
206  PG_RETURN_BOOL(uuid_internal_cmp(arg1, arg2) >= 0);
207 }

References PG_GETARG_UUID_P, PG_RETURN_BOOL, and uuid_internal_cmp().

◆ uuid_gt()

Datum uuid_gt ( PG_FUNCTION_ARGS  )

Definition at line 210 of file uuid.c.

211 {
212  pg_uuid_t *arg1 = PG_GETARG_UUID_P(0);
213  pg_uuid_t *arg2 = PG_GETARG_UUID_P(1);
214 
215  PG_RETURN_BOOL(uuid_internal_cmp(arg1, arg2) > 0);
216 }

References PG_GETARG_UUID_P, PG_RETURN_BOOL, and uuid_internal_cmp().

◆ uuid_hash()

Datum uuid_hash ( PG_FUNCTION_ARGS  )

Definition at line 395 of file uuid.c.

396 {
398 
399  return hash_any(key->data, UUID_LEN);
400 }
static Datum hash_any(const unsigned char *k, int keylen)
Definition: hashfn.h:31

References hash_any(), sort-test::key, PG_GETARG_UUID_P, and UUID_LEN.

◆ uuid_hash_extended()

Datum uuid_hash_extended ( PG_FUNCTION_ARGS  )

Definition at line 403 of file uuid.c.

404 {
406 
407  return hash_any_extended(key->data, UUID_LEN, PG_GETARG_INT64(1));
408 }
#define PG_GETARG_INT64(n)
Definition: fmgr.h:283
static Datum hash_any_extended(const unsigned char *k, int keylen, uint64 seed)
Definition: hashfn.h:37

References hash_any_extended(), sort-test::key, PG_GETARG_INT64, PG_GETARG_UUID_P, and UUID_LEN.

◆ uuid_in()

Datum uuid_in ( PG_FUNCTION_ARGS  )

Definition at line 42 of file uuid.c.

43 {
44  char *uuid_str = PG_GETARG_CSTRING(0);
45  pg_uuid_t *uuid;
46 
47  uuid = (pg_uuid_t *) palloc(sizeof(*uuid));
48  string_to_uuid(uuid_str, uuid, fcinfo->context);
49  PG_RETURN_UUID_P(uuid);
50 }
#define PG_GETARG_CSTRING(n)
Definition: fmgr.h:277
static void string_to_uuid(const char *source, pg_uuid_t *uuid, Node *escontext)
Definition: uuid.c:95

References palloc(), PG_GETARG_CSTRING, PG_RETURN_UUID_P, and string_to_uuid().

Referenced by uuid_generate_internal().

◆ uuid_internal_cmp()

static int uuid_internal_cmp ( const pg_uuid_t arg1,
const pg_uuid_t arg2 
)
static

Definition at line 168 of file uuid.c.

169 {
170  return memcmp(arg1->data, arg2->data, UUID_LEN);
171 }

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().

◆ uuid_le()

Datum uuid_le ( PG_FUNCTION_ARGS  )

Definition at line 183 of file uuid.c.

184 {
185  pg_uuid_t *arg1 = PG_GETARG_UUID_P(0);
186  pg_uuid_t *arg2 = PG_GETARG_UUID_P(1);
187 
188  PG_RETURN_BOOL(uuid_internal_cmp(arg1, arg2) <= 0);
189 }

References PG_GETARG_UUID_P, PG_RETURN_BOOL, and uuid_internal_cmp().

Referenced by brin_minmax_multi_distance_uuid().

◆ uuid_lt()

Datum uuid_lt ( PG_FUNCTION_ARGS  )

Definition at line 174 of file uuid.c.

175 {
176  pg_uuid_t *arg1 = PG_GETARG_UUID_P(0);
177  pg_uuid_t *arg2 = PG_GETARG_UUID_P(1);
178 
179  PG_RETURN_BOOL(uuid_internal_cmp(arg1, arg2) < 0);
180 }

References PG_GETARG_UUID_P, PG_RETURN_BOOL, and uuid_internal_cmp().

◆ uuid_ne()

Datum uuid_ne ( PG_FUNCTION_ARGS  )

Definition at line 219 of file uuid.c.

220 {
221  pg_uuid_t *arg1 = PG_GETARG_UUID_P(0);
222  pg_uuid_t *arg2 = PG_GETARG_UUID_P(1);
223 
224  PG_RETURN_BOOL(uuid_internal_cmp(arg1, arg2) != 0);
225 }

References PG_GETARG_UUID_P, PG_RETURN_BOOL, and uuid_internal_cmp().

◆ uuid_out()

Datum uuid_out ( PG_FUNCTION_ARGS  )

Definition at line 53 of file uuid.c.

54 {
55  pg_uuid_t *uuid = PG_GETARG_UUID_P(0);
56  static const char hex_chars[] = "0123456789abcdef";
57  char *buf,
58  *p;
59  int i;
60 
61  /* counts for the four hyphens and the zero-terminator */
62  buf = palloc(2 * UUID_LEN + 5);
63  p = buf;
64  for (i = 0; i < UUID_LEN; i++)
65  {
66  int hi;
67  int lo;
68 
69  /*
70  * We print uuid values as a string of 8, 4, 4, 4, and then 12
71  * hexadecimal characters, with each group is separated by a hyphen
72  * ("-"). Therefore, add the hyphens at the appropriate places here.
73  */
74  if (i == 4 || i == 6 || i == 8 || i == 10)
75  *p++ = '-';
76 
77  hi = uuid->data[i] >> 4;
78  lo = uuid->data[i] & 0x0F;
79 
80  *p++ = hex_chars[hi];
81  *p++ = hex_chars[lo];
82  }
83  *p = '\0';
84 
86 }
#define PG_RETURN_CSTRING(x)
Definition: fmgr.h:362
static char * buf
Definition: pg_test_fsync.c:73

References buf, pg_uuid_t::data, i, palloc(), PG_GETARG_UUID_P, PG_RETURN_CSTRING, and UUID_LEN.

◆ uuid_recv()

Datum uuid_recv ( PG_FUNCTION_ARGS  )

Definition at line 145 of file uuid.c.

146 {
148  pg_uuid_t *uuid;
149 
150  uuid = (pg_uuid_t *) palloc(UUID_LEN);
151  memcpy(uuid->data, pq_getmsgbytes(buffer, UUID_LEN), UUID_LEN);
152  PG_RETURN_POINTER(uuid);
153 }
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:276
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:361
const char * pq_getmsgbytes(StringInfo msg, int datalen)
Definition: pqformat.c:508
StringInfoData * StringInfo
Definition: stringinfo.h:54

References pg_uuid_t::data, palloc(), PG_GETARG_POINTER, PG_RETURN_POINTER, pq_getmsgbytes(), and UUID_LEN.

◆ uuid_send()

Datum uuid_send ( PG_FUNCTION_ARGS  )

Definition at line 156 of file uuid.c.

157 {
158  pg_uuid_t *uuid = PG_GETARG_UUID_P(0);
159  StringInfoData buffer;
160 
161  pq_begintypsend(&buffer);
162  pq_sendbytes(&buffer, uuid->data, UUID_LEN);
164 }
#define PG_RETURN_BYTEA_P(x)
Definition: fmgr.h:371
void pq_sendbytes(StringInfo buf, const void *data, int datalen)
Definition: pqformat.c:126
void pq_begintypsend(StringInfo buf)
Definition: pqformat.c:326
bytea * pq_endtypsend(StringInfo buf)
Definition: pqformat.c:346

References pg_uuid_t::data, PG_GETARG_UUID_P, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendbytes(), and UUID_LEN.

◆ uuid_sortsupport()

Datum uuid_sortsupport ( PG_FUNCTION_ARGS  )

Definition at line 241 of file uuid.c.

242 {
244 
245  ssup->comparator = uuid_fast_cmp;
246  ssup->ssup_extra = NULL;
247 
248  if (ssup->abbreviate)
249  {
251  MemoryContext oldcontext;
252 
253  oldcontext = MemoryContextSwitchTo(ssup->ssup_cxt);
254 
255  uss = palloc(sizeof(uuid_sortsupport_state));
256  uss->input_count = 0;
257  uss->estimating = true;
258  initHyperLogLog(&uss->abbr_card, 10);
259 
260  ssup->ssup_extra = uss;
261 
266 
267  MemoryContextSwitchTo(oldcontext);
268  }
269 
270  PG_RETURN_VOID();
271 }
#define PG_RETURN_VOID()
Definition: fmgr.h:349
void initHyperLogLog(hyperLogLogState *cState, uint8 bwidth)
Definition: hyperloglog.c:66
MemoryContextSwitchTo(old_ctx)
struct SortSupportData * SortSupport
Definition: sortsupport.h:58
int(* comparator)(Datum x, Datum y, SortSupport ssup)
Definition: sortsupport.h:106
Datum(* abbrev_converter)(Datum original, SortSupport ssup)
Definition: sortsupport.h:172
MemoryContext ssup_cxt
Definition: sortsupport.h:66
int(* abbrev_full_comparator)(Datum x, Datum y, SortSupport ssup)
Definition: sortsupport.h:191
bool(* abbrev_abort)(int memtupcount, SortSupport ssup)
Definition: sortsupport.h:182
int ssup_datum_unsigned_cmp(Datum x, Datum y, SortSupport ssup)
Definition: tuplesort.c:3177
static bool uuid_abbrev_abort(int memtupcount, SortSupport ssup)
Definition: uuid.c:292
static int uuid_fast_cmp(Datum x, Datum y, SortSupport ssup)
Definition: uuid.c:277
static Datum uuid_abbrev_convert(Datum original, SortSupport ssup)
Definition: uuid.c:358

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().