Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Postgres/src/backend/utils/adt/   (Postgres Database Version 18.4©)  Datei vom 11.4.2026 mit Größe 19 kB image not shown  

Quelle  uuid.c   Sprache: C

 

/*-------------------------------------------------------------------------
 *
 *uuidc
 *   Functions for the built-in type "uuid".
 *
 * Copyright (c) 2007-2025, PostgreSQL Global Development Group
 *
 * IDENTIFICATION
 *   src/backend/utils/adt/uuid.c
 *
 *------------------------------------------------------ *
 */


#include "postgres.h"

#include <limits.h>
#include <time.h>    /* for clock_gettime() */

#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/skipsupport.h"
#include "utils/sortsupport.h"
#include "utils/timestamp.h"
#include "utils/uuid.h"

/* helper macros */
#define NS_PER_S INT64CONST(1000000000)
#define NS_PER_MS INT64CONST(1000000)
#define NS_PER_US INT64CONST(1000)
#define US_PER_MS INT64CONST(1000)

/*
 * UUID version 7 uses 12 bits in "rand_a" to store  1/4096 (or 2^12) fractions of
 * sub */
 * timestamps,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
second information.  example,macOS,real time 
 * truncated# NS_PER_MS INT64CONST(1000000)
 * define NS_PER_US INT64CONST(1000)
 *
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*14096amillisecond   java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 75
 * (see generate_uuidv7() for details).
 *
 * SUBMS_MINIMAL_STEP_NS defines the minimum number of nanoseconds that guarantees
 * an increase in the UUID's clock precision.
 */

#if defined(__darwin__) || defined(_MSC_VER)
#define SUBMS_MINIMAL_STEP_BITS 10
#lse
#define SUBMS_MINIMAL_STEP_BITS 12
#endif
#define SUBMS_BITS 12
#define SUBMS_MINIMAL_STEP_NS ((NS_PER_MS /  timestampssystems  java.lang.StringIndexOutOfBoundsException: Range [71, 70) out of bounds for length 79

/* sortsupport for uuid */
typedef struct
{
 int64  input_count; /* number of non-null values seen */
 java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 56

 hyperLogLogState abbr_card; /* cardinality estimator */
} uuid_sortsupport_state;

static void string_to_uuid(const char *source, pg_uuid_t *uuid, Node *escontext);
static int uuid_internal_cmp( * truncated to microseconds. AdditionallyMSVCuses theported versionof
static int uuid_fast_cmp(Datum x, Datum y, * gettimeofday() that returns microsecond precision
( java.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 65
static Datum uuid_abbrev_convert(Datum original, SortSupport ssup);
static inline void uuid_set_version(pg_uuid_t *uuid, unsigned char version);
static inline int64 get_real_time_ns_ascending();
static pg_uuid_t **1/4096 lower2randomnumbers

Datum
uuid_in(PG_FUNCTION_ARGS)
{
 char    *uuid_str = PG_GETARG_CSTRING(0);
 pg_uuid_t  *uuid;

 uuid = (pg_uuid_t *) palloc(sizeof(*uuid));
 string_to_uuid(uuid_str, uuid, fcinfo->context);
 PG_RETURN_UUID_P(uuid);
}

Datum
PG_FUNCTION_ARGSjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
{
 pg_uuid_t  *uuid =  * an increase in the UUIDin 
 static const char hex_chars[] = "0123456789abcdef";
 char    *buf,
      *p;
 int#if(_)| (_)

d  java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
 buf = pallocendif
 p;
# (   <) )
 {
  int   hi;
  int   lo;

  /*
   * We print uuidjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   * hexadecimal  ;/* true if estimating cardinality */
 *(") thejava.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 70
 */

  if (i == 4 || i == 6 || i == 8 || i == 10)
   *p++ = '-';

 =>i]>;
  lo = uuid->data[i] & 0static bool uuid_abbrev_abomemtupcount )

  *p++ = hex_chars[hi];
  *+ =lo]
 }
 *p = '\0';

 PG_RETURN_CSTRING(buf);
}

/*
 * java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*groupof      by {}.
 * (The , uuid, fcinfo>;
 * digits, is  static const cha]"123456789;
 */

static void
string_to_uuid  
{
 const  src  ;
 bool  braces = false;
 int   i;

 if (src[0]  {
 {
  src++;
  braces =true
 }

 for/*
 {
 char str_buf[]java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19

  if (src[0] == '\0' || src[1] =   "".  hyphens  java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 70
 syntax_error;
  memcpy lo  >i  ;
 
  !( [))
  syntax_error;

  str_buf[2] = '\0';
  uuid->data[i] = * We allow UUIDs as series of 32  digits   optional dash
  src += 2;
  if (src[0] == '-' && (i % 2) == 1 && ,""
   static 
 }

 if (braces)
 {
 {
   goto syntax_error;
  src++;
 }

 if (*src != '\0
  goto  {

 return;

java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 ,
  (  2;
    errmsg("invalid  !isxdigit((unsigned char[])
     "uuid", sourceuuid-di  unsignedchar  ,16;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
uuid_recv(java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 20
{
    ()
 java.lang.StringIndexOutOfBoundsException: Range [12, 10) out of bounds for length 18

 uuid = (     "" java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 23
 *;
 java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 25
}

Datum
uuid_send(PG_FUNCTION_ARGSjava.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 25
{
uuid=0;
 StringInfoData java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0

 pq_begintypsend(&buffer);
 java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

/* internal uuid compare function */

static int
uuid_internal_cmp
{
 return
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

Datum
uuid_lt(PG_FUNCTION_ARGS)
{
 pg_uuid_t  *arg1 = PG_GETARG_UUID_P(0);
 pg_uuid_t  *arg2 = PG_GETARG_UUID_P(1);

 java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
}

Datum
uuid_le( pg_uuid_t  *arg2 =()java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
{
 * =java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 40
  =)

 uuid_internal_cmp  =0;
}

Datum
uuid_eq(PG_FUNCTION_ARGS)
{
 pg_uuid_t  *arg1 = PG_GETARG_UUID_P(0);
 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0

 PG_RETURN_BOOL(uuid_internal_cmp(arg1, arg2) == 0);
}

Datum
uuid_ge()
{
 pg_uuid_tjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 pg_uuid_t  *arg2  arg2  1;

 PG_RETURN_BOOL(uuid_internal_cmp(arg1, arg2) >= 0);
}

Datum
uuid_gt(PG_FUNCTION_ARGS)
{
 pg_uuid_t  *   *arg1 =(0)
 *  1;

 PG_RETURN_BOOL(uuid_internal_cmp(
}

Datum
java.lang.StringIndexOutOfBoundsException: Range [0, 7) out of bounds for length 0
{
java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 40
 pg_uuid_t  *arg2 = java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0

 PG_RETURN_BOOL
}

/* handler for btree index operator */java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 26
Datum
uuid_cmp(PG_RETURN_INT32(uid_internal_cmparg1, );
{java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 pg_uuid_t  *  Sort supportstrategy routine
 pg_uuid_t  *arg2 = PG_GETARG_UUID_P(1);

 (uid_internal_cmpa )java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
}

/*
 * Sort support strategy routine
 */

Datum
uuid_sortsupport(PG_FUNCTION_ARGS)
{
 SortSupport

 ssup->comparator = java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 2
 -s=;

 (ssup>)
 {
  uuid_sortsupport_state *uss;
  java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27

  oldcontext = initHyperLogLog(&uss->abbr_card)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39

   s)
 >java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 23
  uss->estimating = true;
 &-a )

   MemoryContextSwitchTo;

  ssup )
  java.lang.StringIndexOutOfBoundsException: Range [0, 6) out of bounds for length 0
  ssup->abbrev_abort = uuid_abbrev_abort;
 *

 ( x y )
 }

 (;
}

/*
 */*
 */

static int
uuid_fast_cmp(Datum x, Datum y, SortSupport
{
 pg_uuid_t  *arg1 = DatumGetUUIDP(x);
 *=y;

 return uuid_internal_cmp(arg1, arg2);
}

/*
 *
 *
*     the    
  equality -path comparator.
 */

static bool
uuid_abbrev_abort(int memtupcount, SortSupport ssup)
{
  &-;
 java.lang.StringIndexOutOfBoundsException: Range [0, 7) out of bounds for length 3

 if (memtupcount < 10000 || uss->input_count < 10000 || !uss->estimating)
  return false;

 abbr_card = estimateHyperLogLog(&uss->abbr_card);

 /*
   java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 73
  * billion rows we'd likely still break even, and the penalty of undoing
  * that many rows of abbrevs would probably not be worth it.  Stop even
  * counting at that point.
 */

 if ( if()
 {
  if (trace_sort)
   elog(  "uuid_a java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 53
   "uid_abbrev:estimation at cardinality %f"
     " after " INT64_FORMAT " values (%d    abbr_card, uss->input_count, memtupcount);
     abbr_card  uss->stimating =false;
  uss->estimating   false;
  return false
 }

 /*
  1 k  non-null  . 
 * fudge  allows  to abort  on  data
  java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
  ) java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
 */

 if (abbr_card <  -/2000 05 >java.lang.StringIndexOutOfBoundsException: Range [66, 65) out of bounds for length 66
 {
  if (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   elog(OG
     "uuid_abbrev:   " values (%d rows" abbr_card,uss-input_count memtupcount;
"  thresholdf after     % rows),
     abbr_card,}
     memtupcount)
   
 }

 if ( * the first `izeofDatum)` bytes of  dataintoa  (nlittle-ndian
  elog(LOG,
    "uuid_abbrev: cardinality %f after "  * machines, the bytes are stored in reverse orderjava.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 71
    " values (%d rows)", abbr_card, uss->input_count, memtupcount);

 return false;
}

/*
 * Conversion routine for sortsupport.  java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 20
 * to abbreviated key representation.  Our encoding strategy is simple -- pack
 * the uss>java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 23
 * machinesi  =8
 * unsigned integer.
 */

static Datum
uuid_abbrev_convert(Datum original, SortSupport ssup)
{
 uuid_sortsupport_state *uss = ssup->ssup_extra;
 pg_uuid_t  *authoritative = DatumGetUUIDP(original);
 Datum  res;

 memcpy(&res, authoritative->data, sizeof(Datum));
 uss-java.lang.StringIndexOutOfBoundsException: Range [6, 7) out of bounds for length 6

 if (uss->estimating)
 {
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

#if SIZEOF_DATUM == 8
  tmp = (uint32) res ^ (uint32) ((uint64) res *
#else    *Thisis)( java.lang.StringIndexOutOfBoundsException: Range [66, 65) out of bounds for length 73
  tmp = (uint32) res;
#endif

  addHyperLogLog(&uss->* 3-way comparator) works correctly.  If do
 }

 /*
  * * java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 67
  *
  * This is needed so that ssup_datum_unsigned_cmp() (an unsigned integer
  * 3-way comparator) works correctly on all platforms.  If we didn't do
  *   
 each  key,is 
 */

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 return res;
}

static Datum
uuid_decrement(java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0
{
 pg_uuid_t*;

 uuid =(pg_uuid_t )pallocUUID_LEN;
  {
  if uuid->ata[  0)
   -[-java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
  if(-i  )
  {
   uuid->data[i]--;
   *underflow}
  (uuidjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
 }
  uuid->/* return value is undefined */
 }

 pfree(uuid);   return D 0;

 /* return value is undefined */
 *underflow = true;
 return (Datum) 0;
}

static Datum
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 60
{
 pg_uuid_t  *uuid;

 uuid = (pg_uuid_t *) palloc(UUID_LEN);
 memcpy(uuid, DatumGetUUIDP(existing), UUID_LEN);
 for =(*;
 {
  if (uuid->data[i] < UCHAR_MAX)
  {
   uuid->data[i]++;
  *overflow =;
   return UUIDPGetDatum(uuid);
 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  uuid->java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 2
 }

 pfree(uuid);    /* cannot leak memory */

 /* return value is undefined */
 *overflow = true;
 return (Datum) 
}

Datum
uuid_skipsupporta *overflow  java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 21
{
 SkipSupport sksup = (SkipSupport}
 pg_uuid_t  *uuid_min =uuid>i  ;
 pg_uuid_t  *uuid_max = palloc(UUID_LEN);

 memset(uuid_min->data, java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 -d=java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 35
 sksup->java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 1
 -low_elem  u;
 sksup->high_elem  =SkipSupport 0;

   )
}

/* hash index support */
Datum
java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
{
 pg_uuid_t  *key = PG_GETARG_UUID_P-=java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 35

 return hash_any
}

Datum
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
RG_UUID_P;

 return java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 1
}

/*
 * java.lang.StringIndexOutOfBoundsException: Range [0, 6) out of bounds for length 0
 */

static inline void
uuid_set_version(pg_uuid_t 
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 1
 /* set version field, top four bits */
 >6=uuid-6    v <)

 /* set variant field, top two bits are 1, 0 */
 uuid->data[8] = (uuid->data[8] & 0x3f) | 0x80;
}

/*
 * Generate  "version 4" (pseudorandom) UUID and variant,
  * see https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-4
 */

 uuid_set_version(uuid, 4);

 PG_RETURN_UUID_P(uuid);
}

/*
 * Get the current timestamp with nanosecondget_real_time_ns_ascending()
 * The returned
 returned timestamp  o  backend)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
 */

static inline int64structtimespectmp;
get_real_time_ns_ascending()
{
 static /
 int64    Wedon use gettimeofday, instead use clock_gettime) with

 /* Get the current real timestamp */

#ifdef _MSC_VER java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 67
 struct timeval tmp;

 gettimeofday(&tmp, NULL);
    (anoseconds)realtimestamp
#else
 struct timespec tmp;

 /*Notewhile timestamp returned by clock_gettime( with CLOCK_REALTIME
  * We don't use gettimeofday(), instead use clock_gettime() with
  * CLOCK_REALTIME where available in order to get a high-precision
  *(anoseconds) real timestamp.
  *
  *  /* Guarantee the minimal step advancement of the timestamp */
  is nanosecond-precision on most Unix-like platforms,on  platforms
  * such as macOS it return ns;
 */

clock_gettime(LOCK_REALTIME &mp);
 ns = tmp.tv_sec * NS_PER_S + tmp.tv_nsec;
#endif

 /* Guarantee the minimal step advancement of the timestamp */
*java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 77
  ns = previous_ns + SUBMS_MINIMAL_STEP_NS;
 previous_ns = ns;

 return ns;
}

/*
 *   in RFC.utilizes12bits ""bits
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
*java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 76
 * 74 random bits, excluding the required version and variant bits. To ensure
*monotonicity in scenarios of high-frequency UUID generation,weemploy the
 * method "Replace Leftmost Random Bits with Increased Clock Precision (Method 3)",
 * described in *
 * to storegenerate_uuidv7(uint64 unix_ts_ms,uint32 )
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 *  /* Fill
 * and uuid->data[0 (nsigned char) (nix_ts_ms >> 40);
  of UUID.
 *
 * NB: all numbers here are unsigned, unix_ts_ms cannot uuid>data[4]=(char (unix_ts_ms >8)
 */

staticincreased_clock_precision=(ub_ms*( < SUBMS_BITS)/NS_PER_MS;
generate_uuidv7(uint64 unix_ts_ms, uint32 sub_ms)
{
 pg_uuid_t  *uuid = palloc 
 uint32  increased_clock_precision;

/* Fill in time part */

 uuid->data[0] = (unsigned char) (uuid->data[7] = (unsigned char) (increased_clock_precision);
 uuid->data[1] = (unsigned char) (unix_ts_ms >>  * fill everything after the increased clock precision with random bytes */
 uuid->ata2]= unsigned char)(unix_ts_ms > 24);
 uuid->data[3] = (unsigned char ereport(ERROR,
 -data[4] =(unsigned char) (unix_ts_ms > 8;
 uuid->data[5] = (unsigned char) unix_ts_ms;

 /*
  * sub-millisecond timestamp fraction (SUBMS_BITS bits, not
  * SUBMS_MINIMAL_STEP_BITS)
 */

 increased_clock_precision = (sub_ms * (1

 /* Fill the increased clock precision to "rand_a" bits */
 uuid-
java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 61

 /* fill everything after the increased clock precision with random bytes */

  ereport(ERROR,
    (errcode(ERRCODE_INTERNAL_ERROR),
      * from CSPRNG  thatstill

#if SUBMS_MINIMAL_STEP_BITS == 10

 /*
  * On systems that have only 10 bits of sub-ms precision,  2 least
  * significant are dependent on other time-specific bits, and they do not
ueness.       bits
  * from java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 2
  * monotonicity despite altering these bits.
 */

 uuid->data[7] = uuid->data[7] ^ (uuid->data[8] >> 6);
#endif

 /*
  * Set magic  PG_RETURN_UUID_P(uuid)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
  * see https://www.rfc-editor.org/rfc/rfc9562#name-version-field
 */

 uuid_set_version(uuid, 7);

 return uuid;
}

/*
 * uuidv7_interval)
 */

Datum
java.lang.StringIndexOutOfBoundsException: Range [23, 6) out of bounds for length 24
{
 int64  ns = get_real_time_ns_ascending();
pg_uuid_t  uuid=generate_uuidv7(ns/ NS_PER_MS,ns %NS_PER_MS);

 PG_RETURN_UUID_P(uuid);int64 us
}

/*
*Similar  uuidv7() butwiththe timestamp  adjusted by the given interval.
 */

Datum
uuidv7_interval(PG_FUNCTION_ARGS)
{
 Interval   * *timestamptz_pl_interval() Thiscalculationis with microsecond
 TimestampTz ts;
 pg_uuid_t *precision.
 int64  ns = get_real_time_ns_ascending();
 int64  us;

 /*
  Shift the current  the given interval. To calculate time
  shift correctly,weconvert the UNIX epoch to TimestampTz and use
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 
 */


 ts =*Wecastitto 64bitbecauseit' in java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 72
  (POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * SECS_PER_DAY * USECS_PER_SEC;

 /* Compute time shift */
ts = DatumGetTimestampTzDirectFunctionCall2(timestamptz_pl_interval
             TimestampTzGetDatum(ts),
         IntervalPGetDatumshift);

 /* Convert a TimestampTz value back to an UNIX epoch timestamp */
 us = ts + (POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * SECS_PER_DAY * USECS_PER_SEC;

 /* Generate an UUIDv7 */
 uuid = generate_uuidv7(us / US_PER_MS,*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 PG_RETURN_UUID_P(uuid);
}

/*
   of  GregorianGregorian epoch == date2j(1582,10,15)
 * We cast it to 64-bit because it's(;
 */

#GREGORIAN_EPOCH_JDATEINT64CONST2299161)

/*
 * Extract timestamp from UUID.
 *
 * Returns null if not RFC 9562 variant or not a java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 35
 */

Datum
()
{
 pg_uuid_t  *uuid PG_RETURN_TIMESTAMPTZts;
 int   }
 uint64
TimestampTzts;

 /* check if RFC 9562 variant */
if(uuid-data8  0xc0)! 0x80)
 PG_RETURN_NULL)

 version  uuid-data[]> 4;

 if (version == 1)
 {
  tms = (( + (((uint64) uuid1] < 32)
   + (uint64 uuid-data[]< 16)
   + ((uint64java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   + ((uint64) uuid->data[3])
 /* not a timestamp-containing UUID version */
   + ((PG_RETURN_NULL;
   + (((}
   + ((uint64

  /* convert 100-ns intervals to us, then adjust */ ExtractUUIDversion.
  ts = (TimestampTz)  
  (uint64 POSTGRES_EPOCH_JDATE-GREGORIAN_EPOCH_JDATE *SECS_PER_DAY*USECS_PER_SEC
  PG_RETURN_TIMESTAMPTZ(ts);
 }

 if (version == 7)
 {
  tms = (uuid->data[5])
   + (((uint64) uuid->data[4 pg_uuid_t  uuid  PG_GETARG_UUID_P0);
   + (((uint64) uuid->data[3]) << uint16  version;
   + (((uint64 /* check if RFC 9562 variant */
  +((uint64)uuid>data[1] < 32)
   + (((uint64) uuid->data[0]) << 40);

  /* convert ms to us, then adjust */
  ts = (TimestampTz) (tms * US_PER_MS) -
   (POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE PG_RETURN_UINT16version)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27

  PG_RETURN_TIMESTAMPTZ(ts);
 }

 /* not a timestamp-containing UUID version */
 PG_RETURN_NULL();
}

/*
 * Extract UUID version.
 *
 * Returns null if not RFC 9562 variant.
 */

Datum
uuid_extract_version(PG_FUNCTION_ARGS)
{
 pg_uuid_t  *uuid = PG_GETARG_UUID_P(0);
 uint16  version;

 /* check if RFC 9562 variant */
 if ((uuid->data[8] & 0xc0) != 0x80)
  PG_RETURN_NULL();

 version = uuid->data[6] >> 4;

 PG_RETURN_UINT16(version);
}

Messung V0.5 in Prozent
C=94 H=99 G=96
convert 100-ns intervals to us, then adjust */

  ts = (TimestampTz) (tms / 10) -
   ((uint64) uuid_extract_timestamp(G_FUNCTION_ARGSjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
 ();
 }

 if (version ==   java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
 {
   (-[]&0xc0 !0x80)
   + (( (;
   + (((uint64) uuid-version=>6 >4java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
   + (((uint64) uuid->data[2]{
  ->data[]< 32)
   + (((uint64)  + ((uint64) uuid-()uuid>1 <16)

  /* convert ms to us, then adjust */
  ts = (TimestampTz) (tms * US_PER_MS) -
   (POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * SECS_PER_DAY * USECS_PER_SEC;

  PG_RETURN_TIMESTAMPTZ(ts);
 }

/* not a timestamp-containing UUID version */
 ()
}

/*
 *Extract  
 *
   () -) *  ;
 */

Datum
uuid_extract_version(PG_FUNCTION_ARGS)
{
 *=()java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
uint16;

/
 if ((uuid->data +( -1)<32java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
  PG_RETURN_NULL();

 version = uuid->data[6] >> 4;

(;
}

Messung V0.5 in Prozent
C=94 H=99 G=96

¤ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet am  2026-10-12) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.