PostgreSQL Source Code  git master
postgres.h File Reference
#include "c.h"
#include "utils/elog.h"
#include "utils/palloc.h"
Include dependency graph for postgres.h:

Go to the source code of this file.

Data Structures

struct  varatt_external
 
struct  varatt_indirect
 
struct  varatt_expanded
 
union  varattrib_4b
 
struct  varattrib_1b
 
struct  varattrib_1b_e
 
struct  NullableDatum
 

Macros

#define VARLENA_EXTSIZE_BITS   30
 
#define VARLENA_EXTSIZE_MASK   ((1U << VARLENA_EXTSIZE_BITS) - 1)
 
#define VARTAG_IS_EXPANDED(tag)    (((tag) & ~1) == VARTAG_EXPANDED_RO)
 
#define VARTAG_SIZE(tag)
 
#define VARATT_IS_4B(PTR)    ((((varattrib_1b *) (PTR))->va_header & 0x01) == 0x00)
 
#define VARATT_IS_4B_U(PTR)    ((((varattrib_1b *) (PTR))->va_header & 0x03) == 0x00)
 
#define VARATT_IS_4B_C(PTR)    ((((varattrib_1b *) (PTR))->va_header & 0x03) == 0x02)
 
#define VARATT_IS_1B(PTR)    ((((varattrib_1b *) (PTR))->va_header & 0x01) == 0x01)
 
#define VARATT_IS_1B_E(PTR)    ((((varattrib_1b *) (PTR))->va_header) == 0x01)
 
#define VARATT_NOT_PAD_BYTE(PTR)    (*((uint8 *) (PTR)) != 0)
 
#define VARSIZE_4B(PTR)    ((((varattrib_4b *) (PTR))->va_4byte.va_header >> 2) & 0x3FFFFFFF)
 
#define VARSIZE_1B(PTR)    ((((varattrib_1b *) (PTR))->va_header >> 1) & 0x7F)
 
#define VARTAG_1B_E(PTR)    (((varattrib_1b_e *) (PTR))->va_tag)
 
#define SET_VARSIZE_4B(PTR, len)    (((varattrib_4b *) (PTR))->va_4byte.va_header = (((uint32) (len)) << 2))
 
#define SET_VARSIZE_4B_C(PTR, len)    (((varattrib_4b *) (PTR))->va_4byte.va_header = (((uint32) (len)) << 2) | 0x02)
 
#define SET_VARSIZE_1B(PTR, len)    (((varattrib_1b *) (PTR))->va_header = (((uint8) (len)) << 1) | 0x01)
 
#define SET_VARTAG_1B_E(PTR, tag)
 
#define VARDATA_4B(PTR)   (((varattrib_4b *) (PTR))->va_4byte.va_data)
 
#define VARDATA_4B_C(PTR)   (((varattrib_4b *) (PTR))->va_compressed.va_data)
 
#define VARDATA_1B(PTR)   (((varattrib_1b *) (PTR))->va_data)
 
#define VARDATA_1B_E(PTR)   (((varattrib_1b_e *) (PTR))->va_data)
 
#define VARHDRSZ_EXTERNAL   offsetof(varattrib_1b_e, va_data)
 
#define VARHDRSZ_COMPRESSED   offsetof(varattrib_4b, va_compressed.va_data)
 
#define VARHDRSZ_SHORT   offsetof(varattrib_1b, va_data)
 
#define VARATT_SHORT_MAX   0x7F
 
#define VARATT_CAN_MAKE_SHORT(PTR)
 
#define VARATT_CONVERTED_SHORT_SIZE(PTR)    (VARSIZE(PTR) - VARHDRSZ + VARHDRSZ_SHORT)
 
#define VARDATA(PTR)   VARDATA_4B(PTR)
 
#define VARSIZE(PTR)   VARSIZE_4B(PTR)
 
#define VARSIZE_SHORT(PTR)   VARSIZE_1B(PTR)
 
#define VARDATA_SHORT(PTR)   VARDATA_1B(PTR)
 
#define VARTAG_EXTERNAL(PTR)   VARTAG_1B_E(PTR)
 
#define VARSIZE_EXTERNAL(PTR)   (VARHDRSZ_EXTERNAL + VARTAG_SIZE(VARTAG_EXTERNAL(PTR)))
 
#define VARDATA_EXTERNAL(PTR)   VARDATA_1B_E(PTR)
 
#define VARATT_IS_COMPRESSED(PTR)   VARATT_IS_4B_C(PTR)
 
#define VARATT_IS_EXTERNAL(PTR)   VARATT_IS_1B_E(PTR)
 
#define VARATT_IS_EXTERNAL_ONDISK(PTR)    (VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_ONDISK)
 
#define VARATT_IS_EXTERNAL_INDIRECT(PTR)    (VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_INDIRECT)
 
#define VARATT_IS_EXTERNAL_EXPANDED_RO(PTR)    (VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_EXPANDED_RO)
 
#define VARATT_IS_EXTERNAL_EXPANDED_RW(PTR)    (VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_EXPANDED_RW)
 
#define VARATT_IS_EXTERNAL_EXPANDED(PTR)    (VARATT_IS_EXTERNAL(PTR) && VARTAG_IS_EXPANDED(VARTAG_EXTERNAL(PTR)))
 
#define VARATT_IS_EXTERNAL_NON_EXPANDED(PTR)    (VARATT_IS_EXTERNAL(PTR) && !VARTAG_IS_EXPANDED(VARTAG_EXTERNAL(PTR)))
 
#define VARATT_IS_SHORT(PTR)   VARATT_IS_1B(PTR)
 
#define VARATT_IS_EXTENDED(PTR)   (!VARATT_IS_4B_U(PTR))
 
#define SET_VARSIZE(PTR, len)   SET_VARSIZE_4B(PTR, len)
 
#define SET_VARSIZE_SHORT(PTR, len)   SET_VARSIZE_1B(PTR, len)
 
#define SET_VARSIZE_COMPRESSED(PTR, len)   SET_VARSIZE_4B_C(PTR, len)
 
#define SET_VARTAG_EXTERNAL(PTR, tag)   SET_VARTAG_1B_E(PTR, tag)
 
#define VARSIZE_ANY(PTR)
 
#define VARSIZE_ANY_EXHDR(PTR)
 
#define VARDATA_ANY(PTR)    (VARATT_IS_1B(PTR) ? VARDATA_1B(PTR) : VARDATA_4B(PTR))
 
#define VARDATA_COMPRESSED_GET_EXTSIZE(PTR)    (((varattrib_4b *) (PTR))->va_compressed.va_tcinfo & VARLENA_EXTSIZE_MASK)
 
#define VARDATA_COMPRESSED_GET_COMPRESS_METHOD(PTR)    (((varattrib_4b *) (PTR))->va_compressed.va_tcinfo >> VARLENA_EXTSIZE_BITS)
 
#define VARATT_EXTERNAL_GET_EXTSIZE(toast_pointer)    ((toast_pointer).va_extinfo & VARLENA_EXTSIZE_MASK)
 
#define VARATT_EXTERNAL_GET_COMPRESS_METHOD(toast_pointer)    ((toast_pointer).va_extinfo >> VARLENA_EXTSIZE_BITS)
 
#define VARATT_EXTERNAL_SET_SIZE_AND_COMPRESS_METHOD(toast_pointer, len, cm)
 
#define VARATT_EXTERNAL_IS_COMPRESSED(toast_pointer)
 
#define FIELDNO_NULLABLE_DATUM_DATUM   0
 
#define FIELDNO_NULLABLE_DATUM_ISNULL   1
 
#define SIZEOF_DATUM   SIZEOF_VOID_P
 
#define DatumGetBool(X)   ((bool) ((X) != 0))
 
#define BoolGetDatum(X)   ((Datum) ((X) ? 1 : 0))
 
#define DatumGetChar(X)   ((char) (X))
 
#define CharGetDatum(X)   ((Datum) (X))
 
#define Int8GetDatum(X)   ((Datum) (X))
 
#define DatumGetUInt8(X)   ((uint8) (X))
 
#define UInt8GetDatum(X)   ((Datum) (X))
 
#define DatumGetInt16(X)   ((int16) (X))
 
#define Int16GetDatum(X)   ((Datum) (X))
 
#define DatumGetUInt16(X)   ((uint16) (X))
 
#define UInt16GetDatum(X)   ((Datum) (X))
 
#define DatumGetInt32(X)   ((int32) (X))
 
#define Int32GetDatum(X)   ((Datum) (X))
 
#define DatumGetUInt32(X)   ((uint32) (X))
 
#define UInt32GetDatum(X)   ((Datum) (X))
 
#define DatumGetObjectId(X)   ((Oid) (X))
 
#define ObjectIdGetDatum(X)   ((Datum) (X))
 
#define DatumGetTransactionId(X)   ((TransactionId) (X))
 
#define TransactionIdGetDatum(X)   ((Datum) (X))
 
#define MultiXactIdGetDatum(X)   ((Datum) (X))
 
#define DatumGetCommandId(X)   ((CommandId) (X))
 
#define CommandIdGetDatum(X)   ((Datum) (X))
 
#define DatumGetPointer(X)   ((Pointer) (X))
 
#define PointerGetDatum(X)   ((Datum) (X))
 
#define DatumGetCString(X)   ((char *) DatumGetPointer(X))
 
#define CStringGetDatum(X)   PointerGetDatum(X)
 
#define DatumGetName(X)   ((Name) DatumGetPointer(X))
 
#define NameGetDatum(X)   CStringGetDatum(NameStr(*(X)))
 
#define DatumGetInt64(X)   (* ((int64 *) DatumGetPointer(X)))
 
#define DatumGetUInt64(X)   (* ((uint64 *) DatumGetPointer(X)))
 
#define UInt64GetDatum(X)   Int64GetDatum((int64) (X))
 
#define DatumGetFloat8(X)   (* ((float8 *) DatumGetPointer(X)))
 
#define Int64GetDatumFast(X)   PointerGetDatum(&(X))
 
#define Float8GetDatumFast(X)   PointerGetDatum(&(X))
 

Typedefs

typedef struct varatt_external varatt_external
 
typedef struct varatt_indirect varatt_indirect
 
typedef struct ExpandedObjectHeader ExpandedObjectHeader
 
typedef struct varatt_expanded varatt_expanded
 
typedef enum vartag_external vartag_external
 
typedef uintptr_t Datum
 
typedef struct NullableDatum NullableDatum
 

Enumerations

enum  vartag_external { VARTAG_INDIRECT = 1 , VARTAG_EXPANDED_RO = 2 , VARTAG_EXPANDED_RW = 3 , VARTAG_ONDISK = 18 }
 

Functions

Datum Int64GetDatum (int64 X)
 
static float4 DatumGetFloat4 (Datum X)
 
static Datum Float4GetDatum (float4 X)
 
Datum Float8GetDatum (float8 X)
 

Macro Definition Documentation

◆ BoolGetDatum

#define BoolGetDatum (   X)    ((Datum) ((X) ? 1 : 0))

Definition at line 446 of file postgres.h.

◆ CharGetDatum

#define CharGetDatum (   X)    ((Datum) (X))

Definition at line 460 of file postgres.h.

◆ CommandIdGetDatum

#define CommandIdGetDatum (   X)    ((Datum) (X))

Definition at line 586 of file postgres.h.

◆ CStringGetDatum

#define CStringGetDatum (   X)    PointerGetDatum(X)

Definition at line 622 of file postgres.h.

◆ DatumGetBool

#define DatumGetBool (   X)    ((bool) ((X) != 0))

Definition at line 437 of file postgres.h.

◆ DatumGetChar

#define DatumGetChar (   X)    ((char) (X))

Definition at line 453 of file postgres.h.

◆ DatumGetCommandId

#define DatumGetCommandId (   X)    ((CommandId) (X))

Definition at line 579 of file postgres.h.

◆ DatumGetCString

#define DatumGetCString (   X)    ((char *) DatumGetPointer(X))

Definition at line 610 of file postgres.h.

◆ DatumGetFloat8

#define DatumGetFloat8 (   X)    (* ((float8 *) DatumGetPointer(X)))

Definition at line 758 of file postgres.h.

◆ DatumGetInt16

#define DatumGetInt16 (   X)    ((int16) (X))

Definition at line 488 of file postgres.h.

◆ DatumGetInt32

#define DatumGetInt32 (   X)    ((int32) (X))

Definition at line 516 of file postgres.h.

◆ DatumGetInt64

#define DatumGetInt64 (   X)    (* ((int64 *) DatumGetPointer(X)))

Definition at line 651 of file postgres.h.

◆ DatumGetName

#define DatumGetName (   X)    ((Name) DatumGetPointer(X))

Definition at line 629 of file postgres.h.

◆ DatumGetObjectId

#define DatumGetObjectId (   X)    ((Oid) (X))

Definition at line 544 of file postgres.h.

◆ DatumGetPointer

#define DatumGetPointer (   X)    ((Pointer) (X))

Definition at line 593 of file postgres.h.

◆ DatumGetTransactionId

#define DatumGetTransactionId (   X)    ((TransactionId) (X))

Definition at line 558 of file postgres.h.

◆ DatumGetUInt16

#define DatumGetUInt16 (   X)    ((uint16) (X))

Definition at line 502 of file postgres.h.

◆ DatumGetUInt32

#define DatumGetUInt32 (   X)    ((uint32) (X))

Definition at line 530 of file postgres.h.

◆ DatumGetUInt64

#define DatumGetUInt64 (   X)    (* ((uint64 *) DatumGetPointer(X)))

Definition at line 678 of file postgres.h.

◆ DatumGetUInt8

#define DatumGetUInt8 (   X)    ((uint8) (X))

Definition at line 474 of file postgres.h.

◆ FIELDNO_NULLABLE_DATUM_DATUM

#define FIELDNO_NULLABLE_DATUM_DATUM   0

Definition at line 421 of file postgres.h.

◆ FIELDNO_NULLABLE_DATUM_ISNULL

#define FIELDNO_NULLABLE_DATUM_ISNULL   1

Definition at line 423 of file postgres.h.

◆ Float8GetDatumFast

#define Float8GetDatumFast (   X)    PointerGetDatum(&(X))

Definition at line 805 of file postgres.h.

◆ Int16GetDatum

#define Int16GetDatum (   X)    ((Datum) (X))

Definition at line 495 of file postgres.h.

◆ Int32GetDatum

#define Int32GetDatum (   X)    ((Datum) (X))

Definition at line 523 of file postgres.h.

◆ Int64GetDatumFast

#define Int64GetDatumFast (   X)    PointerGetDatum(&(X))

Definition at line 804 of file postgres.h.

◆ Int8GetDatum

#define Int8GetDatum (   X)    ((Datum) (X))

Definition at line 467 of file postgres.h.

◆ MultiXactIdGetDatum

#define MultiXactIdGetDatum (   X)    ((Datum) (X))

Definition at line 572 of file postgres.h.

◆ NameGetDatum

#define NameGetDatum (   X)    CStringGetDatum(NameStr(*(X)))

Definition at line 639 of file postgres.h.

◆ ObjectIdGetDatum

#define ObjectIdGetDatum (   X)    ((Datum) (X))

Definition at line 551 of file postgres.h.

◆ PointerGetDatum

#define PointerGetDatum (   X)    ((Datum) (X))

Definition at line 600 of file postgres.h.

◆ SET_VARSIZE

#define SET_VARSIZE (   PTR,
  len 
)    SET_VARSIZE_4B(PTR, len)

Definition at line 342 of file postgres.h.

◆ SET_VARSIZE_1B

#define SET_VARSIZE_1B (   PTR,
  len 
)     (((varattrib_1b *) (PTR))->va_header = (((uint8) (len)) << 1) | 0x01)

Definition at line 273 of file postgres.h.

◆ SET_VARSIZE_4B

#define SET_VARSIZE_4B (   PTR,
  len 
)     (((varattrib_4b *) (PTR))->va_4byte.va_header = (((uint32) (len)) << 2))

Definition at line 269 of file postgres.h.

◆ SET_VARSIZE_4B_C

#define SET_VARSIZE_4B_C (   PTR,
  len 
)     (((varattrib_4b *) (PTR))->va_4byte.va_header = (((uint32) (len)) << 2) | 0x02)

Definition at line 271 of file postgres.h.

◆ SET_VARSIZE_COMPRESSED

#define SET_VARSIZE_COMPRESSED (   PTR,
  len 
)    SET_VARSIZE_4B_C(PTR, len)

Definition at line 344 of file postgres.h.

◆ SET_VARSIZE_SHORT

#define SET_VARSIZE_SHORT (   PTR,
  len 
)    SET_VARSIZE_1B(PTR, len)

Definition at line 343 of file postgres.h.

◆ SET_VARTAG_1B_E

#define SET_VARTAG_1B_E (   PTR,
  tag 
)
Value:
(((varattrib_1b_e *) (PTR))->va_header = 0x01, \
((varattrib_1b_e *) (PTR))->va_tag = (tag))

Definition at line 275 of file postgres.h.

◆ SET_VARTAG_EXTERNAL

#define SET_VARTAG_EXTERNAL (   PTR,
  tag 
)    SET_VARTAG_1B_E(PTR, tag)

Definition at line 346 of file postgres.h.

◆ SIZEOF_DATUM

#define SIZEOF_DATUM   SIZEOF_VOID_P

Definition at line 428 of file postgres.h.

◆ TransactionIdGetDatum

#define TransactionIdGetDatum (   X)    ((Datum) (X))

Definition at line 565 of file postgres.h.

◆ UInt16GetDatum

#define UInt16GetDatum (   X)    ((Datum) (X))

Definition at line 509 of file postgres.h.

◆ UInt32GetDatum

#define UInt32GetDatum (   X)    ((Datum) (X))

Definition at line 537 of file postgres.h.

◆ UInt64GetDatum

#define UInt64GetDatum (   X)    Int64GetDatum((int64) (X))

Definition at line 692 of file postgres.h.

◆ UInt8GetDatum

#define UInt8GetDatum (   X)    ((Datum) (X))

Definition at line 481 of file postgres.h.

◆ VARATT_CAN_MAKE_SHORT

#define VARATT_CAN_MAKE_SHORT (   PTR)
Value:
(VARATT_IS_4B_U(PTR) && \
#define VARHDRSZ
Definition: c.h:627
#define VARHDRSZ_SHORT
Definition: postgres.h:292
#define VARATT_IS_4B_U(PTR)
Definition: postgres.h:250
#define VARSIZE(PTR)
Definition: postgres.h:316
#define VARATT_SHORT_MAX
Definition: postgres.h:294

Definition at line 295 of file postgres.h.

◆ VARATT_CONVERTED_SHORT_SIZE

#define VARATT_CONVERTED_SHORT_SIZE (   PTR)     (VARSIZE(PTR) - VARHDRSZ + VARHDRSZ_SHORT)

Definition at line 298 of file postgres.h.

◆ VARATT_EXTERNAL_GET_COMPRESS_METHOD

#define VARATT_EXTERNAL_GET_COMPRESS_METHOD (   toast_pointer)     ((toast_pointer).va_extinfo >> VARLENA_EXTSIZE_BITS)

Definition at line 373 of file postgres.h.

◆ VARATT_EXTERNAL_GET_EXTSIZE

#define VARATT_EXTERNAL_GET_EXTSIZE (   toast_pointer)     ((toast_pointer).va_extinfo & VARLENA_EXTSIZE_MASK)

Definition at line 371 of file postgres.h.

◆ VARATT_EXTERNAL_IS_COMPRESSED

#define VARATT_EXTERNAL_IS_COMPRESSED (   toast_pointer)
Value:
(VARATT_EXTERNAL_GET_EXTSIZE(toast_pointer) < \
(toast_pointer).va_rawsize - VARHDRSZ)
#define VARATT_EXTERNAL_GET_EXTSIZE(toast_pointer)
Definition: postgres.h:371

Definition at line 391 of file postgres.h.

◆ VARATT_EXTERNAL_SET_SIZE_AND_COMPRESS_METHOD

#define VARATT_EXTERNAL_SET_SIZE_AND_COMPRESS_METHOD (   toast_pointer,
  len,
  cm 
)
Value:
do { \
Assert((cm) == TOAST_PGLZ_COMPRESSION_ID || \
((toast_pointer).va_extinfo = \
(len) | ((uint32) (cm) << VARLENA_EXTSIZE_BITS)); \
} while (0)
unsigned int uint32
Definition: c.h:441
const void size_t len
#define VARLENA_EXTSIZE_BITS
Definition: postgres.h:82
@ TOAST_LZ4_COMPRESSION_ID
@ TOAST_PGLZ_COMPRESSION_ID

Definition at line 376 of file postgres.h.

◆ VARATT_IS_1B

#define VARATT_IS_1B (   PTR)     ((((varattrib_1b *) (PTR))->va_header & 0x01) == 0x01)

Definition at line 254 of file postgres.h.

◆ VARATT_IS_1B_E

#define VARATT_IS_1B_E (   PTR)     ((((varattrib_1b *) (PTR))->va_header) == 0x01)

Definition at line 256 of file postgres.h.

◆ VARATT_IS_4B

#define VARATT_IS_4B (   PTR)     ((((varattrib_1b *) (PTR))->va_header & 0x01) == 0x00)

Definition at line 248 of file postgres.h.

◆ VARATT_IS_4B_C

#define VARATT_IS_4B_C (   PTR)     ((((varattrib_1b *) (PTR))->va_header & 0x03) == 0x02)

Definition at line 252 of file postgres.h.

◆ VARATT_IS_4B_U

#define VARATT_IS_4B_U (   PTR)     ((((varattrib_1b *) (PTR))->va_header & 0x03) == 0x00)

Definition at line 250 of file postgres.h.

◆ VARATT_IS_COMPRESSED

#define VARATT_IS_COMPRESSED (   PTR)    VARATT_IS_4B_C(PTR)

Definition at line 325 of file postgres.h.

◆ VARATT_IS_EXTENDED

#define VARATT_IS_EXTENDED (   PTR)    (!VARATT_IS_4B_U(PTR))

Definition at line 340 of file postgres.h.

◆ VARATT_IS_EXTERNAL

#define VARATT_IS_EXTERNAL (   PTR)    VARATT_IS_1B_E(PTR)

Definition at line 326 of file postgres.h.

◆ VARATT_IS_EXTERNAL_EXPANDED

#define VARATT_IS_EXTERNAL_EXPANDED (   PTR)     (VARATT_IS_EXTERNAL(PTR) && VARTAG_IS_EXPANDED(VARTAG_EXTERNAL(PTR)))

Definition at line 335 of file postgres.h.

◆ VARATT_IS_EXTERNAL_EXPANDED_RO

#define VARATT_IS_EXTERNAL_EXPANDED_RO (   PTR)     (VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_EXPANDED_RO)

Definition at line 331 of file postgres.h.

◆ VARATT_IS_EXTERNAL_EXPANDED_RW

#define VARATT_IS_EXTERNAL_EXPANDED_RW (   PTR)     (VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_EXPANDED_RW)

Definition at line 333 of file postgres.h.

◆ VARATT_IS_EXTERNAL_INDIRECT

#define VARATT_IS_EXTERNAL_INDIRECT (   PTR)     (VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_INDIRECT)

Definition at line 329 of file postgres.h.

◆ VARATT_IS_EXTERNAL_NON_EXPANDED

#define VARATT_IS_EXTERNAL_NON_EXPANDED (   PTR)     (VARATT_IS_EXTERNAL(PTR) && !VARTAG_IS_EXPANDED(VARTAG_EXTERNAL(PTR)))

Definition at line 337 of file postgres.h.

◆ VARATT_IS_EXTERNAL_ONDISK

#define VARATT_IS_EXTERNAL_ONDISK (   PTR)     (VARATT_IS_EXTERNAL(PTR) && VARTAG_EXTERNAL(PTR) == VARTAG_ONDISK)

Definition at line 327 of file postgres.h.

◆ VARATT_IS_SHORT

#define VARATT_IS_SHORT (   PTR)    VARATT_IS_1B(PTR)

Definition at line 339 of file postgres.h.

◆ VARATT_NOT_PAD_BYTE

#define VARATT_NOT_PAD_BYTE (   PTR)     (*((uint8 *) (PTR)) != 0)

Definition at line 258 of file postgres.h.

◆ VARATT_SHORT_MAX

#define VARATT_SHORT_MAX   0x7F

Definition at line 294 of file postgres.h.

◆ VARDATA

#define VARDATA (   PTR)    VARDATA_4B(PTR)

Definition at line 315 of file postgres.h.

◆ VARDATA_1B

#define VARDATA_1B (   PTR)    (((varattrib_1b *) (PTR))->va_data)

Definition at line 283 of file postgres.h.

◆ VARDATA_1B_E

#define VARDATA_1B_E (   PTR)    (((varattrib_1b_e *) (PTR))->va_data)

Definition at line 284 of file postgres.h.

◆ VARDATA_4B

#define VARDATA_4B (   PTR)    (((varattrib_4b *) (PTR))->va_4byte.va_data)

Definition at line 281 of file postgres.h.

◆ VARDATA_4B_C

#define VARDATA_4B_C (   PTR)    (((varattrib_4b *) (PTR))->va_compressed.va_data)

Definition at line 282 of file postgres.h.

◆ VARDATA_ANY

#define VARDATA_ANY (   PTR)     (VARATT_IS_1B(PTR) ? VARDATA_1B(PTR) : VARDATA_4B(PTR))

Definition at line 361 of file postgres.h.

◆ VARDATA_COMPRESSED_GET_COMPRESS_METHOD

#define VARDATA_COMPRESSED_GET_COMPRESS_METHOD (   PTR)     (((varattrib_4b *) (PTR))->va_compressed.va_tcinfo >> VARLENA_EXTSIZE_BITS)

Definition at line 367 of file postgres.h.

◆ VARDATA_COMPRESSED_GET_EXTSIZE

#define VARDATA_COMPRESSED_GET_EXTSIZE (   PTR)     (((varattrib_4b *) (PTR))->va_compressed.va_tcinfo & VARLENA_EXTSIZE_MASK)

Definition at line 365 of file postgres.h.

◆ VARDATA_EXTERNAL

#define VARDATA_EXTERNAL (   PTR)    VARDATA_1B_E(PTR)

Definition at line 323 of file postgres.h.

◆ VARDATA_SHORT

#define VARDATA_SHORT (   PTR)    VARDATA_1B(PTR)

Definition at line 319 of file postgres.h.

◆ VARHDRSZ_COMPRESSED

#define VARHDRSZ_COMPRESSED   offsetof(varattrib_4b, va_compressed.va_data)

Definition at line 291 of file postgres.h.

◆ VARHDRSZ_EXTERNAL

#define VARHDRSZ_EXTERNAL   offsetof(varattrib_1b_e, va_data)

Definition at line 290 of file postgres.h.

◆ VARHDRSZ_SHORT

#define VARHDRSZ_SHORT   offsetof(varattrib_1b, va_data)

Definition at line 292 of file postgres.h.

◆ VARLENA_EXTSIZE_BITS

#define VARLENA_EXTSIZE_BITS   30

Definition at line 82 of file postgres.h.

◆ VARLENA_EXTSIZE_MASK

#define VARLENA_EXTSIZE_MASK   ((1U << VARLENA_EXTSIZE_BITS) - 1)

Definition at line 83 of file postgres.h.

◆ VARSIZE

#define VARSIZE (   PTR)    VARSIZE_4B(PTR)

Definition at line 316 of file postgres.h.

◆ VARSIZE_1B

#define VARSIZE_1B (   PTR)     ((((varattrib_1b *) (PTR))->va_header >> 1) & 0x7F)

Definition at line 264 of file postgres.h.

◆ VARSIZE_4B

#define VARSIZE_4B (   PTR)     ((((varattrib_4b *) (PTR))->va_4byte.va_header >> 2) & 0x3FFFFFFF)

Definition at line 262 of file postgres.h.

◆ VARSIZE_ANY

#define VARSIZE_ANY (   PTR)
Value:
(VARATT_IS_1B(PTR) ? VARSIZE_1B(PTR) : \
VARSIZE_4B(PTR)))
#define VARSIZE_1B(PTR)
Definition: postgres.h:264
#define VARATT_IS_1B_E(PTR)
Definition: postgres.h:256
#define VARSIZE_EXTERNAL(PTR)
Definition: postgres.h:322
#define VARSIZE_4B(PTR)
Definition: postgres.h:262
#define VARATT_IS_1B(PTR)
Definition: postgres.h:254

Definition at line 348 of file postgres.h.

◆ VARSIZE_ANY_EXHDR

#define VARSIZE_ANY_EXHDR (   PTR)
Value:
VARSIZE_4B(PTR)-VARHDRSZ))
#define VARHDRSZ_EXTERNAL
Definition: postgres.h:290

Definition at line 354 of file postgres.h.

◆ VARSIZE_EXTERNAL

#define VARSIZE_EXTERNAL (   PTR)    (VARHDRSZ_EXTERNAL + VARTAG_SIZE(VARTAG_EXTERNAL(PTR)))

Definition at line 322 of file postgres.h.

◆ VARSIZE_SHORT

#define VARSIZE_SHORT (   PTR)    VARSIZE_1B(PTR)

Definition at line 318 of file postgres.h.

◆ VARTAG_1B_E

#define VARTAG_1B_E (   PTR)     (((varattrib_1b_e *) (PTR))->va_tag)

Definition at line 266 of file postgres.h.

◆ VARTAG_EXTERNAL

#define VARTAG_EXTERNAL (   PTR)    VARTAG_1B_E(PTR)

Definition at line 321 of file postgres.h.

◆ VARTAG_IS_EXPANDED

#define VARTAG_IS_EXPANDED (   tag)     (((tag) & ~1) == VARTAG_EXPANDED_RO)

Definition at line 130 of file postgres.h.

◆ VARTAG_SIZE

#define VARTAG_SIZE (   tag)
Value:
((tag) == VARTAG_INDIRECT ? sizeof(varatt_indirect) : \
VARTAG_IS_EXPANDED(tag) ? sizeof(varatt_expanded) : \
(tag) == VARTAG_ONDISK ? sizeof(varatt_external) : \
TrapMacro(true, "unrecognized TOAST vartag"))
#define TrapMacro(condition, errorType)
Definition: c.h:810
struct varatt_external varatt_external
struct varatt_expanded varatt_expanded
@ VARTAG_ONDISK
Definition: postgres.h:126
@ VARTAG_INDIRECT
Definition: postgres.h:123

Definition at line 133 of file postgres.h.

Typedef Documentation

◆ Datum

typedef uintptr_t Datum

Definition at line 411 of file postgres.h.

◆ ExpandedObjectHeader

Definition at line 1 of file postgres.h.

◆ NullableDatum

typedef struct NullableDatum NullableDatum

◆ varatt_expanded

◆ varatt_external

◆ varatt_indirect

◆ vartag_external

Enumeration Type Documentation

◆ vartag_external

Enumerator
VARTAG_INDIRECT 
VARTAG_EXPANDED_RO 
VARTAG_EXPANDED_RW 
VARTAG_ONDISK 

Definition at line 121 of file postgres.h.

122 {
123  VARTAG_INDIRECT = 1,
124  VARTAG_EXPANDED_RO = 2,
125  VARTAG_EXPANDED_RW = 3,
126  VARTAG_ONDISK = 18
vartag_external
Definition: postgres.h:122
@ VARTAG_EXPANDED_RW
Definition: postgres.h:125
@ VARTAG_EXPANDED_RO
Definition: postgres.h:124

Function Documentation

◆ DatumGetFloat4()

static float4 DatumGetFloat4 ( Datum  X)
inlinestatic

Definition at line 708 of file postgres.h.

709 {
710  union
711  {
712  int32 value;
713  float4 retval;
714  } myunion;
715 
716  myunion.value = DatumGetInt32(X);
717  return myunion.retval;
718 }
signed int int32
Definition: c.h:429
float float4
Definition: c.h:564
static struct @142 value
#define DatumGetInt32(X)
Definition: postgres.h:516

References DatumGetInt32, and value.

Referenced by bernoulli_beginsamplescan(), bernoulli_samplescangetsamplesize(), btfloat4fastcmp(), convert_numeric_to_scalar(), gbt_num_compress(), PLyFloat_FromFloat4(), similarity_dist(), similarity_op(), system_beginsamplescan(), and system_samplescangetsamplesize().

◆ Float4GetDatum()

static Datum Float4GetDatum ( float4  X)
inlinestatic

Definition at line 725 of file postgres.h.

726 {
727  union
728  {
729  float4 value;
730  int32 retval;
731  } myunion;
732 
733  myunion.value = X;
734  return Int32GetDatum(myunion.retval);
735 }
#define Int32GetDatum(X)
Definition: postgres.h:523

References Int32GetDatum, and value.

Referenced by AddEnumLabel(), EnumValuesCreate(), gbt_num_fetch(), index_store_float8_orderby_distances(), InsertPgClassTuple(), leftmostvalue_float4(), ProcedureCreate(), serialize_expr_stats(), set_limit(), and update_attstats().

◆ Float8GetDatum()

Datum Float8GetDatum ( float8  X)

◆ Int64GetDatum()