PostgreSQL Source Code  git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
varatt.h File Reference
This graph shows which files directly or indirectly include this file:

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
 

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)
 

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
 

Enumerations

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

Macro Definition Documentation

◆ SET_VARSIZE

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

Definition at line 305 of file varatt.h.

◆ SET_VARSIZE_1B

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

Definition at line 236 of file varatt.h.

◆ SET_VARSIZE_4B

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

Definition at line 232 of file varatt.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 234 of file varatt.h.

◆ SET_VARSIZE_COMPRESSED

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

Definition at line 307 of file varatt.h.

◆ SET_VARSIZE_SHORT

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

Definition at line 306 of file varatt.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 238 of file varatt.h.

◆ SET_VARTAG_EXTERNAL

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

Definition at line 309 of file varatt.h.

◆ VARATT_CAN_MAKE_SHORT

#define VARATT_CAN_MAKE_SHORT (   PTR)
Value:
(VARATT_IS_4B_U(PTR) && \
#define VARHDRSZ
Definition: c.h:695
#define VARHDRSZ_SHORT
Definition: varatt.h:255
#define VARATT_IS_4B_U(PTR)
Definition: varatt.h:213
#define VARSIZE(PTR)
Definition: varatt.h:279
#define VARATT_SHORT_MAX
Definition: varatt.h:257

Definition at line 258 of file varatt.h.

◆ VARATT_CONVERTED_SHORT_SIZE

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

Definition at line 261 of file varatt.h.

◆ VARATT_EXTERNAL_GET_COMPRESS_METHOD

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

Definition at line 336 of file varatt.h.

◆ VARATT_EXTERNAL_GET_EXTSIZE

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

Definition at line 334 of file varatt.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: varatt.h:334

Definition at line 354 of file varatt.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:518
const void size_t len
@ TOAST_LZ4_COMPRESSION_ID
@ TOAST_PGLZ_COMPRESSION_ID
#define VARLENA_EXTSIZE_BITS
Definition: varatt.h:45

Definition at line 339 of file varatt.h.

◆ VARATT_IS_1B

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

Definition at line 217 of file varatt.h.

◆ VARATT_IS_1B_E

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

Definition at line 219 of file varatt.h.

◆ VARATT_IS_4B

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

Definition at line 211 of file varatt.h.

◆ VARATT_IS_4B_C

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

Definition at line 215 of file varatt.h.

◆ VARATT_IS_4B_U

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

Definition at line 213 of file varatt.h.

◆ VARATT_IS_COMPRESSED

#define VARATT_IS_COMPRESSED (   PTR)    VARATT_IS_4B_C(PTR)

Definition at line 288 of file varatt.h.

◆ VARATT_IS_EXTENDED

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

Definition at line 303 of file varatt.h.

◆ VARATT_IS_EXTERNAL

#define VARATT_IS_EXTERNAL (   PTR)    VARATT_IS_1B_E(PTR)

Definition at line 289 of file varatt.h.

◆ VARATT_IS_EXTERNAL_EXPANDED

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

Definition at line 298 of file varatt.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 294 of file varatt.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 296 of file varatt.h.

◆ VARATT_IS_EXTERNAL_INDIRECT

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

Definition at line 292 of file varatt.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 300 of file varatt.h.

◆ VARATT_IS_EXTERNAL_ONDISK

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

Definition at line 290 of file varatt.h.

◆ VARATT_IS_SHORT

#define VARATT_IS_SHORT (   PTR)    VARATT_IS_1B(PTR)

Definition at line 302 of file varatt.h.

◆ VARATT_NOT_PAD_BYTE

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

Definition at line 221 of file varatt.h.

◆ VARATT_SHORT_MAX

#define VARATT_SHORT_MAX   0x7F

Definition at line 257 of file varatt.h.

◆ VARDATA

#define VARDATA (   PTR)    VARDATA_4B(PTR)

Definition at line 278 of file varatt.h.

◆ VARDATA_1B

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

Definition at line 246 of file varatt.h.

◆ VARDATA_1B_E

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

Definition at line 247 of file varatt.h.

◆ VARDATA_4B

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

Definition at line 244 of file varatt.h.

◆ VARDATA_4B_C

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

Definition at line 245 of file varatt.h.

◆ VARDATA_ANY

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

Definition at line 324 of file varatt.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 330 of file varatt.h.

◆ VARDATA_COMPRESSED_GET_EXTSIZE

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

Definition at line 328 of file varatt.h.

◆ VARDATA_EXTERNAL

#define VARDATA_EXTERNAL (   PTR)    VARDATA_1B_E(PTR)

Definition at line 286 of file varatt.h.

◆ VARDATA_SHORT

#define VARDATA_SHORT (   PTR)    VARDATA_1B(PTR)

Definition at line 282 of file varatt.h.

◆ VARHDRSZ_COMPRESSED

#define VARHDRSZ_COMPRESSED   offsetof(varattrib_4b, va_compressed.va_data)

Definition at line 254 of file varatt.h.

◆ VARHDRSZ_EXTERNAL

#define VARHDRSZ_EXTERNAL   offsetof(varattrib_1b_e, va_data)

Definition at line 253 of file varatt.h.

◆ VARHDRSZ_SHORT

#define VARHDRSZ_SHORT   offsetof(varattrib_1b, va_data)

Definition at line 255 of file varatt.h.

◆ VARLENA_EXTSIZE_BITS

#define VARLENA_EXTSIZE_BITS   30

Definition at line 45 of file varatt.h.

◆ VARLENA_EXTSIZE_MASK

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

Definition at line 46 of file varatt.h.

◆ VARSIZE

#define VARSIZE (   PTR)    VARSIZE_4B(PTR)

Definition at line 279 of file varatt.h.

◆ VARSIZE_1B

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

Definition at line 227 of file varatt.h.

◆ VARSIZE_4B

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

Definition at line 225 of file varatt.h.

◆ VARSIZE_ANY

#define VARSIZE_ANY (   PTR)
Value:
(VARATT_IS_1B(PTR) ? VARSIZE_1B(PTR) : \
VARSIZE_4B(PTR)))
#define VARSIZE_1B(PTR)
Definition: varatt.h:227
#define VARATT_IS_1B_E(PTR)
Definition: varatt.h:219
#define VARSIZE_EXTERNAL(PTR)
Definition: varatt.h:285
#define VARSIZE_4B(PTR)
Definition: varatt.h:225
#define VARATT_IS_1B(PTR)
Definition: varatt.h:217

Definition at line 311 of file varatt.h.

◆ VARSIZE_ANY_EXHDR

#define VARSIZE_ANY_EXHDR (   PTR)
Value:
VARSIZE_4B(PTR)-VARHDRSZ))
#define VARHDRSZ_EXTERNAL
Definition: varatt.h:253

Definition at line 317 of file varatt.h.

◆ VARSIZE_EXTERNAL

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

Definition at line 285 of file varatt.h.

◆ VARSIZE_SHORT

#define VARSIZE_SHORT (   PTR)    VARSIZE_1B(PTR)

Definition at line 281 of file varatt.h.

◆ VARTAG_1B_E

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

Definition at line 229 of file varatt.h.

◆ VARTAG_EXTERNAL

#define VARTAG_EXTERNAL (   PTR)    VARTAG_1B_E(PTR)

Definition at line 284 of file varatt.h.

◆ VARTAG_IS_EXPANDED

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

Definition at line 93 of file varatt.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) : \
(AssertMacro(false), 0))
#define AssertMacro(condition)
Definition: c.h:862
struct varatt_external varatt_external
struct varatt_expanded varatt_expanded
@ VARTAG_ONDISK
Definition: varatt.h:89
@ VARTAG_INDIRECT
Definition: varatt.h:86

Definition at line 96 of file varatt.h.

Typedef Documentation

◆ ExpandedObjectHeader

Definition at line 1 of file varatt.h.

◆ 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 84 of file varatt.h.

85 {
86  VARTAG_INDIRECT = 1,
89  VARTAG_ONDISK = 18
vartag_external
Definition: varatt.h:85
@ VARTAG_EXPANDED_RW
Definition: varatt.h:88
@ VARTAG_EXPANDED_RO
Definition: varatt.h:87