PostgreSQL Source Code git master
htup_details.h File Reference
#include "access/htup.h"
#include "access/transam.h"
#include "access/tupdesc.h"
#include "access/tupmacs.h"
#include "storage/bufpage.h"
#include "varatt.h"
Include dependency graph for htup_details.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  HeapTupleFields
 
struct  DatumTupleFields
 
struct  HeapTupleHeaderData
 
struct  MinimalTupleData
 

Macros

#define MaxTupleAttributeNumber   1664 /* 8 * 208 */
 
#define MaxHeapAttributeNumber   1600 /* 8 * 200 */
 
#define FIELDNO_HEAPTUPLEHEADERDATA_INFOMASK2   2
 
#define FIELDNO_HEAPTUPLEHEADERDATA_INFOMASK   3
 
#define FIELDNO_HEAPTUPLEHEADERDATA_HOFF   4
 
#define FIELDNO_HEAPTUPLEHEADERDATA_BITS   5
 
#define SizeofHeapTupleHeader   offsetof(HeapTupleHeaderData, t_bits)
 
#define HEAP_HASNULL   0x0001 /* has null attribute(s) */
 
#define HEAP_HASVARWIDTH   0x0002 /* has variable-width attribute(s) */
 
#define HEAP_HASEXTERNAL   0x0004 /* has external stored attribute(s) */
 
#define HEAP_HASOID_OLD   0x0008 /* has an object-id field */
 
#define HEAP_XMAX_KEYSHR_LOCK   0x0010 /* xmax is a key-shared locker */
 
#define HEAP_COMBOCID   0x0020 /* t_cid is a combo CID */
 
#define HEAP_XMAX_EXCL_LOCK   0x0040 /* xmax is exclusive locker */
 
#define HEAP_XMAX_LOCK_ONLY   0x0080 /* xmax, if valid, is only a locker */
 
#define HEAP_XMAX_SHR_LOCK   (HEAP_XMAX_EXCL_LOCK | HEAP_XMAX_KEYSHR_LOCK)
 
#define HEAP_LOCK_MASK
 
#define HEAP_XMIN_COMMITTED   0x0100 /* t_xmin committed */
 
#define HEAP_XMIN_INVALID   0x0200 /* t_xmin invalid/aborted */
 
#define HEAP_XMIN_FROZEN   (HEAP_XMIN_COMMITTED|HEAP_XMIN_INVALID)
 
#define HEAP_XMAX_COMMITTED   0x0400 /* t_xmax committed */
 
#define HEAP_XMAX_INVALID   0x0800 /* t_xmax invalid/aborted */
 
#define HEAP_XMAX_IS_MULTI   0x1000 /* t_xmax is a MultiXactId */
 
#define HEAP_UPDATED   0x2000 /* this is UPDATEd version of row */
 
#define HEAP_MOVED_OFF
 
#define HEAP_MOVED_IN
 
#define HEAP_MOVED   (HEAP_MOVED_OFF | HEAP_MOVED_IN)
 
#define HEAP_XACT_MASK   0xFFF0 /* visibility-related bits */
 
#define HEAP_XMAX_BITS
 
#define HEAP_NATTS_MASK   0x07FF /* 11 bits for number of attributes */
 
#define HEAP_KEYS_UPDATED
 
#define HEAP_HOT_UPDATED   0x4000 /* tuple was HOT-updated */
 
#define HEAP_ONLY_TUPLE   0x8000 /* this is heap-only tuple */
 
#define HEAP2_XACT_MASK   0xE000 /* visibility-related bits */
 
#define HEAP_TUPLE_HAS_MATCH   HEAP_ONLY_TUPLE /* tuple has a join match */
 
#define HeapTupleHeaderGetNatts(tup)    ((tup)->t_infomask2 & HEAP_NATTS_MASK)
 
#define HeapTupleHeaderSetNatts(tup, natts)
 
#define HeapTupleHeaderHasExternal(tup)    (((tup)->t_infomask & HEAP_HASEXTERNAL) != 0)
 
#define MaxHeapTupleSize   (BLCKSZ - MAXALIGN(SizeOfPageHeaderData + sizeof(ItemIdData)))
 
#define MinHeapTupleSize   MAXALIGN(SizeofHeapTupleHeader)
 
#define MaxHeapTuplesPerPage
 
#define MaxAttrSize   (10 * 1024 * 1024)
 
#define MINIMAL_TUPLE_OFFSET    ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) / MAXIMUM_ALIGNOF * MAXIMUM_ALIGNOF)
 
#define MINIMAL_TUPLE_PADDING    ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) % MAXIMUM_ALIGNOF)
 
#define MINIMAL_TUPLE_DATA_OFFSET    offsetof(MinimalTupleData, t_infomask2)
 
#define SizeofMinimalTupleHeader   offsetof(MinimalTupleData, t_bits)
 

Typedefs

typedef struct HeapTupleFields HeapTupleFields
 
typedef struct DatumTupleFields DatumTupleFields
 

Functions

static bool HEAP_XMAX_IS_LOCKED_ONLY (uint16 infomask)
 
static bool HEAP_LOCKED_UPGRADED (uint16 infomask)
 
static bool HEAP_XMAX_IS_SHR_LOCKED (int16 infomask)
 
static bool HEAP_XMAX_IS_EXCL_LOCKED (int16 infomask)
 
static bool HEAP_XMAX_IS_KEYSHR_LOCKED (int16 infomask)
 
static bool HeapTupleHeaderXminFrozen (const HeapTupleHeaderData *tup)
 
static TransactionId HeapTupleHeaderGetRawXmin (const HeapTupleHeaderData *tup)
 
static TransactionId HeapTupleHeaderGetXmin (const HeapTupleHeaderData *tup)
 
static void HeapTupleHeaderSetXmin (HeapTupleHeaderData *tup, TransactionId xid)
 
static bool HeapTupleHeaderXminCommitted (const HeapTupleHeaderData *tup)
 
static bool HeapTupleHeaderXminInvalid (const HeapTupleHeaderData *tup)
 
static void HeapTupleHeaderSetXminCommitted (HeapTupleHeaderData *tup)
 
static void HeapTupleHeaderSetXminInvalid (HeapTupleHeaderData *tup)
 
static void HeapTupleHeaderSetXminFrozen (HeapTupleHeaderData *tup)
 
static TransactionId HeapTupleHeaderGetRawXmax (const HeapTupleHeaderData *tup)
 
static void HeapTupleHeaderSetXmax (HeapTupleHeaderData *tup, TransactionId xid)
 
static TransactionId HeapTupleHeaderGetUpdateXid (const HeapTupleHeaderData *tup)
 
static CommandId HeapTupleHeaderGetRawCommandId (const HeapTupleHeaderData *tup)
 
static void HeapTupleHeaderSetCmin (HeapTupleHeaderData *tup, CommandId cid)
 
static void HeapTupleHeaderSetCmax (HeapTupleHeaderData *tup, CommandId cid, bool iscombo)
 
static TransactionId HeapTupleHeaderGetXvac (const HeapTupleHeaderData *tup)
 
static void HeapTupleHeaderSetXvac (HeapTupleHeaderData *tup, TransactionId xid)
 
 StaticAssertDecl (MaxOffsetNumber< SpecTokenOffsetNumber, "invalid speculative token constant")
 
static bool HeapTupleHeaderIsSpeculative (const HeapTupleHeaderData *tup)
 
static BlockNumber HeapTupleHeaderGetSpeculativeToken (const HeapTupleHeaderData *tup)
 
static void HeapTupleHeaderSetSpeculativeToken (HeapTupleHeaderData *tup, BlockNumber token)
 
static bool HeapTupleHeaderIndicatesMovedPartitions (const HeapTupleHeaderData *tup)
 
static void HeapTupleHeaderSetMovedPartitions (HeapTupleHeaderData *tup)
 
static uint32 HeapTupleHeaderGetDatumLength (const HeapTupleHeaderData *tup)
 
static void HeapTupleHeaderSetDatumLength (HeapTupleHeaderData *tup, uint32 len)
 
static Oid HeapTupleHeaderGetTypeId (const HeapTupleHeaderData *tup)
 
static void HeapTupleHeaderSetTypeId (HeapTupleHeaderData *tup, Oid datum_typeid)
 
static int32 HeapTupleHeaderGetTypMod (const HeapTupleHeaderData *tup)
 
static void HeapTupleHeaderSetTypMod (HeapTupleHeaderData *tup, int32 typmod)
 
static bool HeapTupleHeaderIsHotUpdated (const HeapTupleHeaderData *tup)
 
static void HeapTupleHeaderSetHotUpdated (HeapTupleHeaderData *tup)
 
static void HeapTupleHeaderClearHotUpdated (HeapTupleHeaderData *tup)
 
static bool HeapTupleHeaderIsHeapOnly (const HeapTupleHeaderData *tup)
 
static void HeapTupleHeaderSetHeapOnly (HeapTupleHeaderData *tup)
 
static void HeapTupleHeaderClearHeapOnly (HeapTupleHeaderData *tup)
 
static int BITMAPLEN (int NATTS)
 
static bool HeapTupleHeaderHasMatch (const MinimalTupleData *tup)
 
static void HeapTupleHeaderSetMatch (MinimalTupleData *tup)
 
static void HeapTupleHeaderClearMatch (MinimalTupleData *tup)
 
static void * GETSTRUCT (const HeapTupleData *tuple)
 
static bool HeapTupleHasNulls (const HeapTupleData *tuple)
 
static bool HeapTupleNoNulls (const HeapTupleData *tuple)
 
static bool HeapTupleHasVarWidth (const HeapTupleData *tuple)
 
static bool HeapTupleAllFixed (const HeapTupleData *tuple)
 
static bool HeapTupleHasExternal (const HeapTupleData *tuple)
 
static bool HeapTupleIsHotUpdated (const HeapTupleData *tuple)
 
static void HeapTupleSetHotUpdated (const HeapTupleData *tuple)
 
static void HeapTupleClearHotUpdated (const HeapTupleData *tuple)
 
static bool HeapTupleIsHeapOnly (const HeapTupleData *tuple)
 
static void HeapTupleSetHeapOnly (const HeapTupleData *tuple)
 
static void HeapTupleClearHeapOnly (const HeapTupleData *tuple)
 
Size heap_compute_data_size (TupleDesc tupleDesc, const Datum *values, const bool *isnull)
 
void heap_fill_tuple (TupleDesc tupleDesc, const Datum *values, const bool *isnull, char *data, Size data_size, uint16 *infomask, bits8 *bit)
 
bool heap_attisnull (HeapTuple tup, int attnum, TupleDesc tupleDesc)
 
Datum nocachegetattr (HeapTuple tup, int attnum, TupleDesc tupleDesc)
 
Datum heap_getsysattr (HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
 
Datum getmissingattr (TupleDesc tupleDesc, int attnum, bool *isnull)
 
HeapTuple heap_copytuple (HeapTuple tuple)
 
void heap_copytuple_with_tuple (HeapTuple src, HeapTuple dest)
 
Datum heap_copy_tuple_as_datum (HeapTuple tuple, TupleDesc tupleDesc)
 
HeapTuple heap_form_tuple (TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
 
HeapTuple heap_modify_tuple (HeapTuple tuple, TupleDesc tupleDesc, const Datum *replValues, const bool *replIsnull, const bool *doReplace)
 
HeapTuple heap_modify_tuple_by_cols (HeapTuple tuple, TupleDesc tupleDesc, int nCols, const int *replCols, const Datum *replValues, const bool *replIsnull)
 
void heap_deform_tuple (HeapTuple tuple, TupleDesc tupleDesc, Datum *values, bool *isnull)
 
void heap_freetuple (HeapTuple htup)
 
MinimalTuple heap_form_minimal_tuple (TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
 
void heap_free_minimal_tuple (MinimalTuple mtup)
 
MinimalTuple heap_copy_minimal_tuple (MinimalTuple mtup)
 
HeapTuple heap_tuple_from_minimal_tuple (MinimalTuple mtup)
 
MinimalTuple minimal_tuple_from_heap_tuple (HeapTuple htup)
 
size_t varsize_any (void *p)
 
HeapTuple heap_expand_tuple (HeapTuple sourceTuple, TupleDesc tupleDesc)
 
MinimalTuple minimal_expand_tuple (HeapTuple sourceTuple, TupleDesc tupleDesc)
 
static Datum fastgetattr (HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
 
static Datum heap_getattr (HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
 

Macro Definition Documentation

◆ FIELDNO_HEAPTUPLEHEADERDATA_BITS

#define FIELDNO_HEAPTUPLEHEADERDATA_BITS   5

Definition at line 177 of file htup_details.h.

◆ FIELDNO_HEAPTUPLEHEADERDATA_HOFF

#define FIELDNO_HEAPTUPLEHEADERDATA_HOFF   4

Definition at line 172 of file htup_details.h.

◆ FIELDNO_HEAPTUPLEHEADERDATA_INFOMASK

#define FIELDNO_HEAPTUPLEHEADERDATA_INFOMASK   3

Definition at line 169 of file htup_details.h.

◆ FIELDNO_HEAPTUPLEHEADERDATA_INFOMASK2

#define FIELDNO_HEAPTUPLEHEADERDATA_INFOMASK2   2

Definition at line 166 of file htup_details.h.

◆ HEAP2_XACT_MASK

#define HEAP2_XACT_MASK   0xE000 /* visibility-related bits */

Definition at line 293 of file htup_details.h.

◆ HEAP_COMBOCID

#define HEAP_COMBOCID   0x0020 /* t_cid is a combo CID */

Definition at line 195 of file htup_details.h.

◆ HEAP_HASEXTERNAL

#define HEAP_HASEXTERNAL   0x0004 /* has external stored attribute(s) */

Definition at line 192 of file htup_details.h.

◆ HEAP_HASNULL

#define HEAP_HASNULL   0x0001 /* has null attribute(s) */

Definition at line 190 of file htup_details.h.

◆ HEAP_HASOID_OLD

#define HEAP_HASOID_OLD   0x0008 /* has an object-id field */

Definition at line 193 of file htup_details.h.

◆ HEAP_HASVARWIDTH

#define HEAP_HASVARWIDTH   0x0002 /* has variable-width attribute(s) */

Definition at line 191 of file htup_details.h.

◆ HEAP_HOT_UPDATED

#define HEAP_HOT_UPDATED   0x4000 /* tuple was HOT-updated */

Definition at line 290 of file htup_details.h.

◆ HEAP_KEYS_UPDATED

#define HEAP_KEYS_UPDATED
Value:
0x2000 /* tuple was updated and key cols
* modified, or tuple deleted */

Definition at line 289 of file htup_details.h.

◆ HEAP_LOCK_MASK

#define HEAP_LOCK_MASK
Value:
HEAP_XMAX_KEYSHR_LOCK)
#define HEAP_XMAX_SHR_LOCK
Definition: htup_details.h:200
#define HEAP_XMAX_EXCL_LOCK
Definition: htup_details.h:196

Definition at line 202 of file htup_details.h.

◆ HEAP_MOVED

#define HEAP_MOVED   (HEAP_MOVED_OFF | HEAP_MOVED_IN)

Definition at line 213 of file htup_details.h.

◆ HEAP_MOVED_IN

#define HEAP_MOVED_IN
Value:
0x8000 /* moved from another place by pre-9.0
* VACUUM FULL; kept for binary
* upgrade support */

Definition at line 212 of file htup_details.h.

◆ HEAP_MOVED_OFF

#define HEAP_MOVED_OFF
Value:
0x4000 /* moved to another place by pre-9.0
* VACUUM FULL; kept for binary
* upgrade support */

Definition at line 211 of file htup_details.h.

◆ HEAP_NATTS_MASK

#define HEAP_NATTS_MASK   0x07FF /* 11 bits for number of attributes */

Definition at line 287 of file htup_details.h.

◆ HEAP_ONLY_TUPLE

#define HEAP_ONLY_TUPLE   0x8000 /* this is heap-only tuple */

Definition at line 291 of file htup_details.h.

◆ HEAP_TUPLE_HAS_MATCH

#define HEAP_TUPLE_HAS_MATCH   HEAP_ONLY_TUPLE /* tuple has a join match */

Definition at line 301 of file htup_details.h.

◆ HEAP_UPDATED

#define HEAP_UPDATED   0x2000 /* this is UPDATEd version of row */

Definition at line 210 of file htup_details.h.

◆ HEAP_XACT_MASK

#define HEAP_XACT_MASK   0xFFF0 /* visibility-related bits */

Definition at line 215 of file htup_details.h.

◆ HEAP_XMAX_BITS

#define HEAP_XMAX_BITS
Value:
HEAP_XMAX_IS_MULTI | HEAP_LOCK_MASK | HEAP_XMAX_LOCK_ONLY)
#define HEAP_XMAX_LOCK_ONLY
Definition: htup_details.h:197
#define HEAP_LOCK_MASK
Definition: htup_details.h:202
#define HEAP_XMAX_COMMITTED
Definition: htup_details.h:207
#define HEAP_XMAX_INVALID
Definition: htup_details.h:208

Definition at line 281 of file htup_details.h.

◆ HEAP_XMAX_COMMITTED

#define HEAP_XMAX_COMMITTED   0x0400 /* t_xmax committed */

Definition at line 207 of file htup_details.h.

◆ HEAP_XMAX_EXCL_LOCK

#define HEAP_XMAX_EXCL_LOCK   0x0040 /* xmax is exclusive locker */

Definition at line 196 of file htup_details.h.

◆ HEAP_XMAX_INVALID

#define HEAP_XMAX_INVALID   0x0800 /* t_xmax invalid/aborted */

Definition at line 208 of file htup_details.h.

◆ HEAP_XMAX_IS_MULTI

#define HEAP_XMAX_IS_MULTI   0x1000 /* t_xmax is a MultiXactId */

Definition at line 209 of file htup_details.h.

◆ HEAP_XMAX_KEYSHR_LOCK

#define HEAP_XMAX_KEYSHR_LOCK   0x0010 /* xmax is a key-shared locker */

Definition at line 194 of file htup_details.h.

◆ HEAP_XMAX_LOCK_ONLY

#define HEAP_XMAX_LOCK_ONLY   0x0080 /* xmax, if valid, is only a locker */

Definition at line 197 of file htup_details.h.

◆ HEAP_XMAX_SHR_LOCK

#define HEAP_XMAX_SHR_LOCK   (HEAP_XMAX_EXCL_LOCK | HEAP_XMAX_KEYSHR_LOCK)

Definition at line 200 of file htup_details.h.

◆ HEAP_XMIN_COMMITTED

#define HEAP_XMIN_COMMITTED   0x0100 /* t_xmin committed */

Definition at line 204 of file htup_details.h.

◆ HEAP_XMIN_FROZEN

#define HEAP_XMIN_FROZEN   (HEAP_XMIN_COMMITTED|HEAP_XMIN_INVALID)

Definition at line 206 of file htup_details.h.

◆ HEAP_XMIN_INVALID

#define HEAP_XMIN_INVALID   0x0200 /* t_xmin invalid/aborted */

Definition at line 205 of file htup_details.h.

◆ HeapTupleHeaderGetNatts

#define HeapTupleHeaderGetNatts (   tup)     ((tup)->t_infomask2 & HEAP_NATTS_MASK)

Definition at line 577 of file htup_details.h.

◆ HeapTupleHeaderHasExternal

#define HeapTupleHeaderHasExternal (   tup)     (((tup)->t_infomask & HEAP_HASEXTERNAL) != 0)

Definition at line 585 of file htup_details.h.

◆ HeapTupleHeaderSetNatts

#define HeapTupleHeaderSetNatts (   tup,
  natts 
)
Value:
( \
(tup)->t_infomask2 = ((tup)->t_infomask2 & ~HEAP_NATTS_MASK) | (natts) \
)

Definition at line 580 of file htup_details.h.

◆ MaxAttrSize

#define MaxAttrSize   (10 * 1024 * 1024)

Definition at line 635 of file htup_details.h.

◆ MaxHeapAttributeNumber

#define MaxHeapAttributeNumber   1600 /* 8 * 200 */

Definition at line 48 of file htup_details.h.

◆ MaxHeapTupleSize

#define MaxHeapTupleSize   (BLCKSZ - MAXALIGN(SizeOfPageHeaderData + sizeof(ItemIdData)))

Definition at line 610 of file htup_details.h.

◆ MaxHeapTuplesPerPage

#define MaxHeapTuplesPerPage
Value:
((int) ((BLCKSZ - SizeOfPageHeaderData) / \
#define SizeOfPageHeaderData
Definition: bufpage.h:217
#define MAXALIGN(LEN)
Definition: c.h:768
#define SizeofHeapTupleHeader
Definition: htup_details.h:185
struct ItemIdData ItemIdData

Definition at line 624 of file htup_details.h.

◆ MaxTupleAttributeNumber

#define MaxTupleAttributeNumber   1664 /* 8 * 208 */

Definition at line 34 of file htup_details.h.

◆ MinHeapTupleSize

#define MinHeapTupleSize   MAXALIGN(SizeofHeapTupleHeader)

Definition at line 611 of file htup_details.h.

◆ MINIMAL_TUPLE_DATA_OFFSET

#define MINIMAL_TUPLE_DATA_OFFSET    offsetof(MinimalTupleData, t_infomask2)

Definition at line 673 of file htup_details.h.

◆ MINIMAL_TUPLE_OFFSET

#define MINIMAL_TUPLE_OFFSET    ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) / MAXIMUM_ALIGNOF * MAXIMUM_ALIGNOF)

Definition at line 669 of file htup_details.h.

◆ MINIMAL_TUPLE_PADDING

#define MINIMAL_TUPLE_PADDING    ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) % MAXIMUM_ALIGNOF)

Definition at line 671 of file htup_details.h.

◆ SizeofHeapTupleHeader

#define SizeofHeapTupleHeader   offsetof(HeapTupleHeaderData, t_bits)

Definition at line 185 of file htup_details.h.

◆ SizeofMinimalTupleHeader

#define SizeofMinimalTupleHeader   offsetof(MinimalTupleData, t_bits)

Definition at line 699 of file htup_details.h.

Typedef Documentation

◆ DatumTupleFields

◆ HeapTupleFields

Function Documentation

◆ BITMAPLEN()

◆ fastgetattr()

static Datum fastgetattr ( HeapTuple  tup,
int  attnum,
TupleDesc  tupleDesc,
bool *  isnull 
)
inlinestatic

Definition at line 860 of file htup_details.h.

866{
867 Assert(attnum > 0);
868
869 *isnull = false;
870 if (HeapTupleNoNulls(tup))
871 {
872 CompactAttribute *att;
873
874 att = TupleDescCompactAttr(tupleDesc, attnum - 1);
875 if (att->attcacheoff >= 0)
876 return fetchatt(att, (char *) tup->t_data + tup->t_data->t_hoff +
877 att->attcacheoff);
878 else
879 return nocachegetattr(tup, attnum, tupleDesc);
880 }
881 else
882 {
883 if (att_isnull(attnum - 1, tup->t_data->t_bits))
884 {
885 *isnull = true;
886 return (Datum) NULL;
#define Assert(condition)
Definition: c.h:815
Datum nocachegetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc)
Definition: heaptuple.c:521
static bool HeapTupleNoNulls(const HeapTupleData *tuple)
Definition: htup_details.h:744
int16 attnum
Definition: pg_attribute.h:74
uintptr_t Datum
Definition: postgres.h:69
int32 attcacheoff
Definition: tupdesc.h:70
HeapTupleHeader t_data
Definition: htup.h:68
bits8 t_bits[FLEXIBLE_ARRAY_MEMBER]
Definition: htup_details.h:178
static CompactAttribute * TupleDescCompactAttr(TupleDesc tupdesc, int i)
Definition: tupdesc.h:169
static bool att_isnull(int ATT, const bits8 *BITS)
Definition: tupmacs.h:26
#define fetchatt(A, T)
Definition: tupmacs.h:47

References Assert, att_isnull(), CompactAttribute::attcacheoff, attnum, fetchatt, HeapTupleNoNulls(), nocachegetattr(), HeapTupleHeaderData::t_bits, HeapTupleData::t_data, HeapTupleHeaderData::t_hoff, and TupleDescCompactAttr().

Referenced by AttrDefaultFetch(), CatalogCacheComputeTupleHashValue(), check_toast_tuple(), CheckConstraintFetch(), extractRelOptions(), heap_fetch_toast_slice(), heap_getattr(), load_domaintype_info(), MergeWithExistingConstraint(), pg_get_triggerdef_worker(), RelationBuildTriggers(), RelationGetExclusionInfo(), RelationInitIndexAccessInfo(), ReorderBufferToastAppendChunk(), and ReorderBufferToastReplace().

◆ getmissingattr()

Datum getmissingattr ( TupleDesc  tupleDesc,
int  attnum,
bool *  isnull 
)

Definition at line 151 of file heaptuple.c.

153{
154 CompactAttribute *att;
155
156 Assert(attnum <= tupleDesc->natts);
157 Assert(attnum > 0);
158
159 att = TupleDescCompactAttr(tupleDesc, attnum - 1);
160
161 if (att->atthasmissing)
162 {
163 AttrMissing *attrmiss;
164
165 Assert(tupleDesc->constr);
166 Assert(tupleDesc->constr->missing);
167
168 attrmiss = tupleDesc->constr->missing + (attnum - 1);
169
170 if (attrmiss->am_present)
171 {
173 missing_cache_key *entry;
174 bool found;
175 MemoryContext oldctx;
176
177 *isnull = false;
178
179 /* no need to cache by-value attributes */
180 if (att->attbyval)
181 return attrmiss->am_value;
182
183 /* set up cache if required */
184 if (missing_cache == NULL)
186
187 /* check if there's a cache entry */
188 Assert(att->attlen > 0 || att->attlen == -1);
189 if (att->attlen > 0)
190 key.len = att->attlen;
191 else
192 key.len = VARSIZE_ANY(attrmiss->am_value);
193 key.value = attrmiss->am_value;
194
195 entry = hash_search(missing_cache, &key, HASH_ENTER, &found);
196
197 if (!found)
198 {
199 /* cache miss, so we need a non-transient copy of the datum */
201 entry->value =
202 datumCopy(attrmiss->am_value, false, att->attlen);
203 MemoryContextSwitchTo(oldctx);
204 }
205
206 return entry->value;
207 }
208 }
209
210 *isnull = true;
211 return PointerGetDatum(NULL);
212}
Datum datumCopy(Datum value, bool typByVal, int typLen)
Definition: datum.c:132
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
Definition: dynahash.c:955
static void init_missing_cache()
Definition: heaptuple.c:126
static HTAB * missing_cache
Definition: heaptuple.c:101
@ HASH_ENTER
Definition: hsearch.h:114
MemoryContext TopMemoryContext
Definition: mcxt.c:149
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:124
static Datum PointerGetDatum(const void *X)
Definition: postgres.h:327
int16 attlen
Definition: tupdesc.h:71
bool atthasmissing
Definition: tupdesc.h:76
struct AttrMissing * missing
Definition: tupdesc.h:42
TupleConstr * constr
Definition: tupdesc.h:135
#define VARSIZE_ANY(PTR)
Definition: varatt.h:311

References AttrMissing::am_present, AttrMissing::am_value, Assert, CompactAttribute::attbyval, CompactAttribute::atthasmissing, CompactAttribute::attlen, attnum, TupleDescData::constr, datumCopy(), HASH_ENTER, hash_search(), init_missing_cache(), sort-test::key, MemoryContextSwitchTo(), TupleConstr::missing, missing_cache, PointerGetDatum(), TopMemoryContext, TupleDescCompactAttr(), missing_cache_key::value, and VARSIZE_ANY.

Referenced by heap_getattr().

◆ GETSTRUCT()

static void * GETSTRUCT ( const HeapTupleData tuple)
inlinestatic

Definition at line 728 of file htup_details.h.

734{

References HeapTupleData::t_data, and HeapTupleHeaderData::t_hoff.

Referenced by _int_matchsel(), aclitemout(), add_cast_to(), add_function_cost(), AddEnumLabel(), AddRoleMems(), AdjustNotNullInheritance(), AfterTriggerSetState(), agg_args_support_sendreceive(), AggregateCreate(), AlterCollation(), AlterConstraintNamespaces(), AlterConstrTriggerDeferrability(), AlterDatabase(), AlterDatabaseOwner(), AlterDatabaseRefreshColl(), AlterDomainAddConstraint(), AlterDomainDefault(), AlterDomainDropConstraint(), AlterDomainNotNull(), AlterDomainValidateConstraint(), AlterEventTrigger(), AlterEventTriggerOwner(), AlterEventTriggerOwner_internal(), AlterExtensionNamespace(), AlterForeignDataWrapper(), AlterForeignDataWrapperOwner(), AlterForeignDataWrapperOwner_internal(), AlterForeignServer(), AlterForeignServerOwner(), AlterForeignServerOwner_internal(), AlterFunction(), AlterObjectNamespace_internal(), AlterObjectRename_internal(), AlterOperator(), AlterOpFamily(), AlterPolicy(), AlterPublication(), AlterPublicationOptions(), AlterPublicationOwner(), AlterPublicationOwner_internal(), AlterPublicationSchemas(), AlterPublicationTables(), AlterRelationNamespaceInternal(), AlterRole(), AlterRoleSet(), AlterSchemaOwner(), AlterSchemaOwner_internal(), AlterSeqNamespaces(), AlterSequence(), AlterSubscription(), AlterSubscriptionOwner(), AlterSubscriptionOwner_internal(), AlterTableMoveAll(), AlterTableSpaceOptions(), AlterTSConfiguration(), AlterTSDictionary(), AlterType(), AlterTypeNamespaceInternal(), AlterTypeOwner(), AlterTypeOwner_oid(), AlterTypeOwnerInternal(), AlterTypeRecurse(), amvalidate(), appendFunctionName(), appendOrderBySuffix(), ApplyExtensionUpdates(), assignOperTypes(), assignProcTypes(), ATAddForeignKeyConstraint(), ATDetachCheckNoForeignKeyRefs(), ATExecAddColumn(), ATExecAddIdentity(), ATExecAddOf(), ATExecAlterChildConstr(), ATExecAlterColumnGenericOptions(), ATExecAlterColumnType(), ATExecAlterConstraint(), ATExecAlterConstrRecurse(), ATExecChangeOwner(), ATExecDropColumn(), ATExecDropExpression(), ATExecDropIdentity(), ATExecDropNotNull(), ATExecDropOf(), ATExecForceNoForceRowSecurity(), ATExecGenericOptions(), ATExecSetAccessMethodNoStorage(), ATExecSetCompression(), ATExecSetExpression(), ATExecSetIdentity(), ATExecSetNotNull(), ATExecSetOptions(), ATExecSetRowSecurity(), ATExecSetStatistics(), ATExecSetStorage(), ATExecValidateConstraint(), ATPostAlterTypeCleanup(), ATPrepAddPrimaryKey(), ATPrepAlterColumnType(), ATPrepChangePersistence(), ATPrepDropExpression(), AttrDefaultFetch(), blvalidate(), booltestsel(), brinvalidate(), btvalidate(), build_coercion_expression(), build_datatype(), build_function_result_tupdesc_t(), BuildEventTriggerCache(), CacheInvalidateHeapTupleCommon(), CacheInvalidateRelcacheByTuple(), calc_arraycontsel(), calc_multirangesel(), calc_rangesel(), call_pltcl_start_proc(), change_owner_fix_column_acls(), change_owner_recurse_to_sequences(), changeDependenciesOf(), changeDependenciesOn(), changeDependencyFor(), check_amop_signature(), check_amproc_signature(), check_db_file_conflict(), check_default_text_search_config(), check_enable_rls(), check_for_column_name_collision(), check_object_ownership(), check_of_type(), check_role(), check_safe_enum_use(), check_session_authorization(), CheckAlterPublication(), CheckConstraintFetch(), checkDomainOwner(), checkEnumOwner(), CheckFunctionValidatorAccess(), CheckIndexCompatible(), CheckMyDatabase(), checkSharedDependencies(), clear_subscription_skip_lsn(), CloneFkReferenced(), CloneFkReferencing(), CloneRowTriggersToPartition(), CollationIsVisibleExt(), comparison_ops_are_compatible(), compatible_oper(), compile_plperl_function(), compile_pltcl_function(), compute_return_type(), ComputeIndexAttrs(), ComputePartitionAttrs(), constraints_equivalent(), ConstraintSetParentConstraint(), ConstructTupleDescriptor(), ConversionIsVisibleExt(), convert_column_name(), copy_table_data(), CopyStatistics(), copyTemplateDependencies(), create_pg_locale(), create_pg_locale_icu(), create_toast_table(), CreateCast(), CreateDatabaseUsingFileCopy(), CreateFunction(), CreateInheritance(), CreateProceduralLanguage(), CreateRole(), CreateSchemaCommand(), CreateStatistics(), CreateTransform(), CreateTriggerFiringOn(), database_is_invalid_oid(), decompile_conbin(), DefineCollation(), DefineDomain(), DefineIndex(), DefineOpClass(), DefineTSConfiguration(), DefineType(), deleteDependencyRecordsFor(), deleteDependencyRecordsForClass(), deleteDependencyRecordsForSpecific(), DeleteInheritsTuple(), DelRoleMems(), deparseOpExpr(), deparseScalarArrayOpExpr(), DetachPartitionFinalize(), do_autovacuum(), do_compile(), do_setval(), drop_parent_dependency(), DropClonedTriggersFromPartition(), DropConfigurationMapping(), dropconstraint_internal(), dropdb(), DropRole(), DropSubscription(), DropTableSpace(), EnableDisableRule(), EnableDisableTrigger(), enum_cmp_internal(), enum_endpoint(), enum_in(), enum_out(), enum_range_internal(), enum_recv(), enum_send(), eqjoinsel(), equality_ops_are_compatible(), errdatatype(), estimate_hash_bucket_stats(), evaluate_function(), EventTriggerOnLogin(), examine_attribute(), examine_expression(), exec_object_restorecon(), ExecAlterExtensionStmt(), ExecGrant_Attribute(), ExecGrant_Language_check(), ExecGrant_Largeobject(), ExecGrant_Relation(), ExecGrant_Type_check(), ExecInitAgg(), ExecuteCallStmt(), ExecuteDoStmt(), expand_all_col_privileges(), expand_function_arguments(), expand_vacuum_rel(), extract_autovac_opts(), extractNotNullColumn(), extractRelOptions(), fetch_agg_sort_op(), fetch_fp_info(), fetch_statentries_for_relation(), fillTypeDesc(), find_coercion_pathway(), find_composite_type_dependencies(), find_inheritance_children_extended(), find_typed_table_dependencies(), find_typmod_coercion_function(), FindDefaultConversion(), findDependentObjects(), findDomainNotNullConstraint(), findNotNullConstraintAttnum(), finish_heap_swap(), fixup_whole_row_references(), fmgr_info_cxt_security(), fmgr_info_other_lang(), fmgr_security_definer(), fmgr_sql_validator(), fmgr_symbol(), format_operator_extended(), format_operator_parts(), format_procedure_extended(), format_procedure_parts(), format_type_extended(), func_get_detail(), func_parallel(), func_strict(), func_volatile(), FuncNameAsType(), FuncnameGetCandidates(), FunctionIsVisibleExt(), generate_collation_name(), generate_function_name(), generate_operator_clause(), generate_operator_name(), generate_qualified_relation_name(), generate_qualified_type_name(), generate_relation_name(), generateClonedExtStatsStmt(), generateClonedIndexStmt(), GenerateTypeDependencies(), generic_restriction_selectivity(), get_all_vacuum_rels(), get_am_name(), get_am_type_oid(), get_array_type(), get_attavgwidth(), get_attgenerated(), get_attname(), get_attnum(), get_attr_stat_type(), get_attstatsslot(), get_atttype(), get_atttypetypmodcoll(), get_base_element_type(), get_collation(), get_collation_isdeterministic(), get_collation_name(), get_commutator(), get_compatible_hash_operators(), get_constraint_index(), get_constraint_name(), get_constraint_type(), get_database_list(), get_database_name(), get_database_oid(), get_db_info(), get_default_partition_oid(), get_domain_constraint_oid(), get_element_type(), get_extension_name(), get_extension_schema(), get_func_arg_info(), get_func_leakproof(), get_func_name(), get_func_namespace(), get_func_nargs(), get_func_prokind(), get_func_retset(), get_func_rettype(), get_func_signature(), get_func_support(), get_func_variadictype(), get_function_rows(), get_index_column_opclass(), get_index_constraint(), get_index_isclustered(), get_index_isreplident(), get_index_isvalid(), get_index_ref_constraints(), get_language_name(), get_mergejoin_opfamilies(), get_multirange_range(), get_namespace_name(), get_negator(), get_object_address_defacl(), get_object_address_opf_member(), get_object_address_type(), get_object_address_usermapping(), get_op_btree_interpretation(), get_op_hash_functions(), get_op_opfamily_properties(), get_op_opfamily_sortfamily(), get_op_opfamily_strategy(), get_op_rettype(), get_opclass(), get_opclass_family(), get_opclass_input_type(), get_opclass_method(), get_opclass_name(), get_opclass_oid(), get_opclass_opfamily_and_input_type(), get_opcode(), get_opfamily_member(), get_opfamily_name(), get_opfamily_oid(), get_opfamily_proc(), get_opname(), get_oprjoin(), get_oprrest(), get_ordering_op_for_equality_op(), get_ordering_op_properties(), get_partition_parent_worker(), get_pkey_attnames(), get_primary_key_attnos(), get_publication_name(), get_range_collation(), get_range_multirange(), get_range_subtype(), get_rel_name(), get_rel_namespace(), get_rel_persistence(), get_rel_relam(), get_rel_relispartition(), get_rel_relkind(), get_rel_tablespace(), get_rel_type_id(), get_relation_constraint_attnos(), get_relation_constraint_oid(), get_relation_idx_constraint_oid(), get_relation_policy_oid(), get_relation_statistics(), get_relation_statistics_worker(), get_rels_with_domain(), get_rewrite_oid(), get_ri_constraint_root(), get_rolespec_name(), get_rte_attribute_is_dropped(), get_subscription_list(), get_subscription_name(), get_tables_to_cluster(), get_tablespace_name(), get_tablespace_oid(), get_transform_fromsql(), get_transform_tosql(), get_trigger_oid(), get_typ_typrelid(), get_typbyval(), get_typcollation(), get_typdefault(), get_type_category_preferred(), get_type_io_data(), get_typisdefined(), get_typlen(), get_typlenbyval(), get_typlenbyvalalign(), get_typmodin(), get_typstorage(), get_typsubscript(), get_typtype(), get_variable_numdistinct(), get_variable_range(), GetAllTablesPublicationRelations(), GetAllTablesPublications(), GetAttrDefaultColumnAddress(), GetAttrDefaultOid(), getAutoExtensionsOfObject(), getBaseTypeAndTypmod(), getConstraintTypeDescription(), GetDefaultOpClass(), getExtensionOfObject(), GetFdwRoutineByServerId(), GetForeignDataWrapperExtended(), GetForeignKeyActionTriggers(), GetForeignKeyCheckTriggers(), GetForeignServerExtended(), GetForeignServerIdByRelId(), GetForeignTable(), GetIndexAmRoutineByAmId(), getObjectDescription(), getObjectIdentityParts(), getOpFamilyDescription(), getOpFamilyIdentity(), getOwnedSequences_internal(), GetParentedForeignKeyRefs(), getProcedureTypeDescription(), GetPublication(), GetPublicationRelations(), getPublicationSchemaInfo(), GetPublicationSchemas(), getRelationDescription(), getRelationIdentity(), GetRelationPublications(), getRelationsInNamespace(), getRelationTypeDescription(), GetSchemaPublicationRelations(), GetSchemaPublications(), GetSubscription(), GetSubscriptionRelations(), GetSubscriptionRelState(), getTypeBinaryInputInfo(), getTypeBinaryOutputInfo(), getTypeInputInfo(), getTypeIOParam(), getTypeOutputInfo(), GetUserMapping(), GetUserNameFromId(), ginvalidate(), gistvalidate(), has_bypassrls_privilege(), has_createrole_privilege(), has_rolreplication(), has_subclass(), hash_ok_operator(), hashvalidate(), have_createdb_privilege(), heap_drop_with_catalog(), heap_truncate_find_FKs(), identify_opfamily_groups(), index_build(), index_check_primary_key(), index_concurrently_swap(), index_constraint_create(), index_create(), index_get_partition(), index_set_state_flags(), index_update_stats(), indexam_property(), IndexGetRelation(), IndexSetParentIndex(), IndexSupportsBackwardScan(), init_database_collation(), init_sql_fcache(), initialize_peragg(), InitializeSessionUserId(), InitPostgres(), inline_function(), inline_set_returning_function(), InsertRule(), internal_get_result_type(), interpret_function_parameter_list(), inv_getsize(), inv_read(), inv_truncate(), inv_write(), IsBinaryCoercibleWithCast(), load_domaintype_info(), load_enum_cache_data(), load_rangetype_info(), load_relcache_init_file(), logicalrep_write_tuple(), logicalrep_write_typ(), lookup_C_func(), lookup_collation(), lookup_ts_config_cache(), lookup_ts_dictionary_cache(), lookup_ts_parser_cache(), lookup_type_cache(), LookupOpclassInfo(), LookupTypeNameOid(), make_inh_translation_list(), make_op(), make_scalar_array_op(), makeConfigurationDependencies(), MakeConfigurationMapping(), makeDictionaryDependencies(), makeOperatorDependencies(), makeParserDependencies(), makeTSTemplateDependencies(), map_sql_table_to_xmlschema(), map_sql_type_to_xml_name(), mark_index_clustered(), MarkInheritDetached(), MatchNamedCall(), MergeAttributesIntoExisting(), MergeConstraintsIntoExisting(), mergejoinscansel(), MergeWithExistingConstraint(), neqjoinsel(), networkjoinsel_inner(), networkjoinsel_semi(), networksel(), nextval_internal(), nulltestsel(), objectsInSchemaToOids(), op_hashjoinable(), op_input_types(), op_mergejoinable(), opclass_for_family_datatype(), OpClassCacheLookup(), OpclassIsVisibleExt(), OperatorGet(), OperatorIsVisibleExt(), OperatorUpd(), OpernameGetCandidates(), OpernameGetOprid(), OpFamilyCacheLookup(), OpfamilyIsVisibleExt(), oprfuncid(), oprid(), ParseFuncOrColumn(), parseTypeString(), PartitionHasPendingDetach(), patternsel_common(), pg_attribute_aclcheck_all_ext(), pg_attribute_aclmask_ext(), pg_basetype(), pg_class_aclmask_ext(), pg_collation_actual_version(), pg_database_collation_actual_version(), pg_get_constraintdef_worker(), pg_get_function_arg_default(), pg_get_function_result(), pg_get_functiondef(), pg_get_indexdef_worker(), pg_get_partkeydef_worker(), pg_get_serial_sequence(), pg_get_statisticsobj_worker(), pg_get_statisticsobjdef_expressions(), pg_get_triggerdef_worker(), pg_get_userbyid(), pg_largeobject_aclmask_snapshot(), pg_namespace_aclmask_ext(), pg_nextoid(), pg_relation_filenode(), pg_relation_filepath(), pg_relation_is_publishable(), pg_sequence_parameters(), pg_type_aclmask_ext(), plan_member_revoke(), plan_recursive_revoke(), plan_single_revoke(), plperl_validator(), plpgsql_compile(), plpgsql_parse_cwordtype(), plpgsql_validator(), plpython3_validator(), plsample_func_handler(), plsample_trigger_handler(), PLy_procedure_create(), populate_typ_list(), postgres_fdw_get_connections_internal(), prepare_column_cache(), prepare_sql_fn_parse_info(), preprocess_aggref(), preprocessNamespacePath(), print_function_arguments(), print_function_rettype(), print_function_sqlbody(), ProcedureCreate(), QueueCheckConstraintValidation(), QueueFKConstraintValidation(), RangeVarCallbackForAlterRelation(), RangeVarCallbackForAttachIndex(), RangeVarCallbackForDropRelation(), RangeVarCallbackForPolicy(), RangeVarCallbackForRenameAttribute(), RangeVarCallbackForRenameRule(), RangeVarCallbackForRenameTrigger(), RangeVarCallbackForTruncate(), RangeVarCallbackOwnsRelation(), read_seq_tuple(), recheck_cast_function_args(), record_C_func(), recordExtObjInitPriv(), refresh_by_match_merge(), regclassout(), regcollationout(), regconfigout(), regdictionaryout(), regoperout(), regprocout(), regtypeout(), reindex_index(), ReindexMultipleTables(), relation_mark_replica_identity(), relation_statistics_update(), RelationBuildDesc(), RelationBuildPartitionKey(), RelationBuildPublicationDesc(), RelationBuildRowSecurity(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationBuildTupleDesc(), RelationCacheInitializePhase3(), RelationClearMissing(), RelationGetExclusionInfo(), RelationGetFKeyList(), RelationGetIndexList(), RelationGetNotNullConstraints(), RelationGetStatExtList(), relationHasPrimaryKey(), RelationInitIndexAccessInfo(), RelationInitPhysicalAddr(), RelationInitTableAccessMethod(), RelationIsVisibleExt(), RelationReloadIndexInfo(), RelationReloadNailed(), RelationSetNewRelfilenumber(), RelidByRelfilenumber(), RememberAllDependentForRebuilding(), remove_dbtablespaces(), RemoveAttrDefault(), RemoveAttrDefaultById(), RemoveAttributeById(), RemoveConstraintById(), removeExtObjInitPriv(), RemoveFunctionById(), RemoveInheritance(), RemoveOperatorById(), RemovePolicyById(), RemovePublicationById(), RemovePublicationRelById(), RemovePublicationSchemaById(), RemoveRewriteRuleById(), RemoveRoleFromObjectACL(), RemoveRoleFromObjectPolicy(), RemoveStatisticsById(), RemoveSubscriptionRel(), RemoveTriggerById(), RemoveTypeById(), rename_constraint_internal(), rename_policy(), renameatt_internal(), RenameConstraintById(), RenameDatabase(), RenameEnumLabel(), RenameRelationInternal(), RenameRewriteRule(), RenameRole(), RenameSchema(), RenameTableSpace(), renametrig(), renametrig_internal(), renametrig_partition(), RenameType(), RenameTypeInternal(), RenumberEnumType(), reorder_function_arguments(), replorigin_by_name(), replorigin_by_oid(), ResetRelRewrite(), ResetSequence(), ResolveOpClass(), ri_GenerateQualCollation(), ri_LoadConstraintInfo(), roles_is_member_of(), scalararraysel_containment(), scalarineqsel(), ScanSourceDatabasePgClassTuple(), SearchSysCacheAttName(), SearchSysCacheAttNum(), sepgsql_attribute_post_create(), sepgsql_database_post_create(), sepgsql_proc_post_create(), sepgsql_proc_setattr(), sepgsql_relation_drop(), sepgsql_relation_post_create(), sepgsql_relation_setattr(), sepgsql_schema_post_create(), sequence_options(), sequenceIsOwned(), set_attnotnull(), SetAttrMissing(), SetDatabaseHasLoginEventTriggers(), SetDefaultACL(), SetIndexStorageProperties(), SetMatViewPopulatedState(), SetRelationHasSubclass(), SetRelationNumChecks(), SetRelationRuleStatus(), SetRelationTableSpace(), shdepChangeDep(), shdepDropDependency(), shdepDropOwned(), shdepReassignOwned(), simplify_function(), sort_order_cmp(), spgproperty(), spgvalidate(), SPI_gettype(), StatisticsGetRelation(), StatisticsObjIsVisibleExt(), StoreAttrDefault(), StorePartitionBound(), stringTypeDatum(), superuser_arg(), swap_relation_files(), table_recheck_autovac(), transformColumnDefinition(), transformColumnNameList(), transformColumnType(), transformFkeyCheckAttrs(), transformFkeyGetPrimaryKey(), transformFrameOffset(), transformOfType(), triggered_change_notification(), TriggerSetParentTrigger(), tryAttachPartitionForeignKey(), TSConfigIsVisibleExt(), TSDictionaryIsVisibleExt(), TSParserIsVisibleExt(), tsquerysel(), TSTemplateIsVisibleExt(), TupleDescInitEntry(), typeByVal(), TypeCreate(), typeidTypeRelid(), typeInheritsFrom(), typeIsOfTypedTable(), TypeIsVisibleExt(), typeLen(), typenameType(), typenameTypeId(), typenameTypeIdAndMod(), typenameTypeMod(), typeOrDomainTypeRelid(), typeTypeCollation(), typeTypeId(), typeTypeName(), typeTypeRelid(), update_default_partition_oid(), update_relispartition(), vac_truncate_clog(), vac_update_datfrozenxid(), vac_update_relstats(), validatePartitionedIndex(), var_eq_const(), var_eq_non_const(), and verify_dictoptions().

◆ heap_attisnull()

bool heap_attisnull ( HeapTuple  tup,
int  attnum,
TupleDesc  tupleDesc 
)

Definition at line 456 of file heaptuple.c.

457{
458 /*
459 * We allow a NULL tupledesc for relations not expected to have missing
460 * values, such as catalog relations and indexes.
461 */
462 Assert(!tupleDesc || attnum <= tupleDesc->natts);
463 if (attnum > (int) HeapTupleHeaderGetNatts(tup->t_data))
464 {
465 if (tupleDesc &&
466 TupleDescCompactAttr(tupleDesc, attnum - 1)->atthasmissing)
467 return false;
468 else
469 return true;
470 }
471
472 if (attnum > 0)
473 {
474 if (HeapTupleNoNulls(tup))
475 return false;
476 return att_isnull(attnum - 1, tup->t_data->t_bits);
477 }
478
479 switch (attnum)
480 {
487 /* these are never null */
488 break;
489
490 default:
491 elog(ERROR, "invalid attnum: %d", attnum);
492 }
493
494 return false;
495}
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:225
#define HeapTupleHeaderGetNatts(tup)
Definition: htup_details.h:577
#define MinTransactionIdAttributeNumber
Definition: sysattr.h:22
#define MaxCommandIdAttributeNumber
Definition: sysattr.h:25
#define MaxTransactionIdAttributeNumber
Definition: sysattr.h:24
#define TableOidAttributeNumber
Definition: sysattr.h:26
#define SelfItemPointerAttributeNumber
Definition: sysattr.h:21
#define MinCommandIdAttributeNumber
Definition: sysattr.h:23

References Assert, att_isnull(), attnum, elog, ERROR, HeapTupleHeaderGetNatts, HeapTupleNoNulls(), MaxCommandIdAttributeNumber, MaxTransactionIdAttributeNumber, MinCommandIdAttributeNumber, MinTransactionIdAttributeNumber, SelfItemPointerAttributeNumber, HeapTupleHeaderData::t_bits, HeapTupleData::t_data, TableOidAttributeNumber, and TupleDescCompactAttr().

Referenced by AlterPublicationOptions(), AlterPublicationSchemas(), build_function_result_tupdesc_t(), check_index_is_clusterable(), check_modified_virtual_generated(), CheckIndexCompatible(), ExecEvalRowNullInt(), ExecuteCallStmt(), fmgr_info_cxt_security(), fmgr_symbol(), get_func_result_name(), index_drop(), inline_function(), inline_set_returning_function(), IsIndexUsableForReplicaIdentityFull(), pg_get_indexdef_worker(), pg_get_partkeydef_worker(), pg_get_statisticsobj_worker(), pg_get_statisticsobjdef_expressions(), RelationGetDummyIndexExpressions(), RelationGetIndexExpressions(), RelationGetIndexList(), RelationGetIndexPredicate(), statext_is_kind_built(), and transformFkeyCheckAttrs().

◆ heap_compute_data_size()

Size heap_compute_data_size ( TupleDesc  tupleDesc,
const Datum values,
const bool *  isnull 
)

Definition at line 219 of file heaptuple.c.

222{
223 Size data_length = 0;
224 int i;
225 int numberOfAttributes = tupleDesc->natts;
226
227 for (i = 0; i < numberOfAttributes; i++)
228 {
229 Datum val;
230 CompactAttribute *atti;
231
232 if (isnull[i])
233 continue;
234
235 val = values[i];
236 atti = TupleDescCompactAttr(tupleDesc, i);
237
238 if (COMPACT_ATTR_IS_PACKABLE(atti) &&
240 {
241 /*
242 * we're anticipating converting to a short varlena header, so
243 * adjust length and don't count any alignment
244 */
246 }
247 else if (atti->attlen == -1 &&
249 {
250 /*
251 * we want to flatten the expanded value so that the constructed
252 * tuple doesn't depend on it
253 */
254 data_length = att_nominal_alignby(data_length, atti->attalignby);
255 data_length += EOH_get_flat_size(DatumGetEOHP(val));
256 }
257 else
258 {
259 data_length = att_datum_alignby(data_length, atti->attalignby,
260 atti->attlen, val);
261 data_length = att_addlength_datum(data_length, atti->attlen,
262 val);
263 }
264 }
265
266 return data_length;
267}
static Datum values[MAXATTR]
Definition: bootstrap.c:151
size_t Size
Definition: c.h:562
ExpandedObjectHeader * DatumGetEOHP(Datum d)
Definition: expandeddatum.c:29
Size EOH_get_flat_size(ExpandedObjectHeader *eohptr)
Definition: expandeddatum.c:75
#define COMPACT_ATTR_IS_PACKABLE(att)
Definition: heaptuple.c:87
long val
Definition: informix.c:689
int i
Definition: isn.c:72
static Pointer DatumGetPointer(Datum X)
Definition: postgres.h:317
uint8 attalignby
Definition: tupdesc.h:80
#define att_nominal_alignby(cur_offset, attalignby)
Definition: tupmacs.h:165
#define att_datum_alignby(cur_offset, attalignby, attlen, attdatum)
Definition: tupmacs.h:98
#define att_addlength_datum(cur_offset, attlen, attdatum)
Definition: tupmacs.h:173
#define VARATT_CAN_MAKE_SHORT(PTR)
Definition: varatt.h:258
#define VARATT_IS_EXTERNAL_EXPANDED(PTR)
Definition: varatt.h:298
#define VARATT_CONVERTED_SHORT_SIZE(PTR)
Definition: varatt.h:261

References att_addlength_datum, att_datum_alignby, att_nominal_alignby, CompactAttribute::attalignby, CompactAttribute::attlen, COMPACT_ATTR_IS_PACKABLE, DatumGetEOHP(), DatumGetPointer(), EOH_get_flat_size(), i, TupleDescData::natts, TupleDescCompactAttr(), val, values, VARATT_CAN_MAKE_SHORT, VARATT_CONVERTED_SHORT_SIZE, and VARATT_IS_EXTERNAL_EXPANDED.

Referenced by brin_form_tuple(), ER_get_flat_size(), heap_form_minimal_tuple(), heap_form_tuple(), heap_toast_insert_or_update(), index_form_tuple_context(), spgFormLeafTuple(), SpGistGetLeafTupleSize(), and toast_flatten_tuple_to_datum().

◆ heap_copy_minimal_tuple()

MinimalTuple heap_copy_minimal_tuple ( MinimalTuple  mtup)

Definition at line 1536 of file heaptuple.c.

1537{
1538 MinimalTuple result;
1539
1540 result = (MinimalTuple) palloc(mtup->t_len);
1541 memcpy(result, mtup, mtup->t_len);
1542 return result;
1543}
MinimalTupleData * MinimalTuple
Definition: htup.h:27
void * palloc(Size size)
Definition: mcxt.c:1317

References palloc(), and MinimalTupleData::t_len.

Referenced by gm_readnext_tuple(), tts_minimal_copy_minimal_tuple(), tts_minimal_materialize(), tuplesort_gettupleslot(), and tuplestore_gettupleslot().

◆ heap_copy_tuple_as_datum()

Datum heap_copy_tuple_as_datum ( HeapTuple  tuple,
TupleDesc  tupleDesc 
)

Definition at line 1081 of file heaptuple.c.

1082{
1083 HeapTupleHeader td;
1084
1085 /*
1086 * If the tuple contains any external TOAST pointers, we have to inline
1087 * those fields to meet the conventions for composite-type Datums.
1088 */
1089 if (HeapTupleHasExternal(tuple))
1091 tuple->t_len,
1092 tupleDesc);
1093
1094 /*
1095 * Fast path for easy case: just make a palloc'd copy and insert the
1096 * correct composite-Datum header fields (since those may not be set if
1097 * the given tuple came from disk, rather than from heap_form_tuple).
1098 */
1099 td = (HeapTupleHeader) palloc(tuple->t_len);
1100 memcpy((char *) td, (char *) tuple->t_data, tuple->t_len);
1101
1103 HeapTupleHeaderSetTypeId(td, tupleDesc->tdtypeid);
1104 HeapTupleHeaderSetTypMod(td, tupleDesc->tdtypmod);
1105
1106 return PointerGetDatum(td);
1107}
Datum toast_flatten_tuple_to_datum(HeapTupleHeader tup, uint32 tup_len, TupleDesc tupleDesc)
Definition: heaptoast.c:449
HeapTupleHeaderData * HeapTupleHeader
Definition: htup.h:23
static void HeapTupleHeaderSetTypMod(HeapTupleHeaderData *tup, int32 typmod)
Definition: htup_details.h:522
static bool HeapTupleHasExternal(const HeapTupleData *tuple)
Definition: htup_details.h:762
static void HeapTupleHeaderSetTypeId(HeapTupleHeaderData *tup, Oid datum_typeid)
Definition: htup_details.h:510
static void HeapTupleHeaderSetDatumLength(HeapTupleHeaderData *tup, uint32 len)
Definition: htup_details.h:498
uint32 t_len
Definition: htup.h:64
int32 tdtypmod
Definition: tupdesc.h:133
Oid tdtypeid
Definition: tupdesc.h:132

References HeapTupleHasExternal(), HeapTupleHeaderSetDatumLength(), HeapTupleHeaderSetTypeId(), HeapTupleHeaderSetTypMod(), palloc(), PointerGetDatum(), HeapTupleData::t_data, HeapTupleData::t_len, TupleDescData::tdtypeid, TupleDescData::tdtypmod, and toast_flatten_tuple_to_datum().

Referenced by ExecEvalConvertRowtype(), ExecFetchSlotHeapTupleDatum(), PLyGenericObject_ToComposite(), PLyMapping_ToComposite(), PLySequence_ToComposite(), serialize_expr_stats(), and SPI_returntuple().

◆ heap_copytuple()

HeapTuple heap_copytuple ( HeapTuple  tuple)

Definition at line 778 of file heaptuple.c.

779{
780 HeapTuple newTuple;
781
782 if (!HeapTupleIsValid(tuple) || tuple->t_data == NULL)
783 return NULL;
784
785 newTuple = (HeapTuple) palloc(HEAPTUPLESIZE + tuple->t_len);
786 newTuple->t_len = tuple->t_len;
787 newTuple->t_self = tuple->t_self;
788 newTuple->t_tableOid = tuple->t_tableOid;
789 newTuple->t_data = (HeapTupleHeader) ((char *) newTuple + HEAPTUPLESIZE);
790 memcpy((char *) newTuple->t_data, (char *) tuple->t_data, tuple->t_len);
791 return newTuple;
792}
#define HEAPTUPLESIZE
Definition: htup.h:73
HeapTupleData * HeapTuple
Definition: htup.h:71
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
ItemPointerData t_self
Definition: htup.h:65
Oid t_tableOid
Definition: htup.h:66

References HeapTupleIsValid, HEAPTUPLESIZE, palloc(), HeapTupleData::t_data, HeapTupleData::t_len, HeapTupleData::t_self, and HeapTupleData::t_tableOid.

Referenced by AlterConstraintNamespaces(), AlterConstrTriggerDeferrability(), AlterDomainValidateConstraint(), AlterExtensionNamespace(), AlterSequence(), AlterTypeOwner(), ATExecAlterConstrRecurse(), changeDependenciesOf(), changeDependenciesOn(), changeDependencyFor(), ConstraintSetParentConstraint(), CopyStatistics(), CreateTriggerFiringOn(), DefineIndex(), dropconstraint_internal(), EnableDisableTrigger(), ExecForceStoreHeapTuple(), expanded_record_set_tuple(), findDomainNotNullConstraint(), findNotNullConstraintAttnum(), get_catalog_object_by_oid_extended(), GetDatabaseTuple(), GetDatabaseTupleByOid(), index_concurrently_swap(), make_expanded_record_from_datum(), MarkInheritDetached(), MergeConstraintsIntoExisting(), MergeWithExistingConstraint(), QueueCheckConstraintValidation(), QueueFKConstraintValidation(), RelationInitIndexAccessInfo(), RemoveInheritance(), rename_policy(), RenameEnumLabel(), RenameTableSpace(), renametrig_internal(), RenumberEnumType(), ResetSequence(), rewrite_heap_tuple(), ScanPgRelation(), SearchSysCacheCopy(), SearchSysCacheCopyAttName(), SearchSysCacheCopyAttNum(), SearchSysCacheLockedCopy1(), shdepChangeDep(), SPI_copytuple(), statext_expressions_load(), systable_inplace_update_begin(), TriggerSetParentTrigger(), tts_buffer_heap_copy_heap_tuple(), tts_buffer_heap_materialize(), tts_heap_copy_heap_tuple(), tts_heap_materialize(), and tuplesort_putheaptuple().

◆ heap_copytuple_with_tuple()

void heap_copytuple_with_tuple ( HeapTuple  src,
HeapTuple  dest 
)

Definition at line 804 of file heaptuple.c.

805{
806 if (!HeapTupleIsValid(src) || src->t_data == NULL)
807 {
808 dest->t_data = NULL;
809 return;
810 }
811
812 dest->t_len = src->t_len;
813 dest->t_self = src->t_self;
814 dest->t_tableOid = src->t_tableOid;
815 dest->t_data = (HeapTupleHeader) palloc(src->t_len);
816 memcpy((char *) dest->t_data, (char *) src->t_data, src->t_len);
817}

References generate_unaccent_rules::dest, HeapTupleIsValid, palloc(), HeapTupleData::t_data, HeapTupleData::t_len, HeapTupleData::t_self, and HeapTupleData::t_tableOid.

◆ heap_deform_tuple()

void heap_deform_tuple ( HeapTuple  tuple,
TupleDesc  tupleDesc,
Datum values,
bool *  isnull 
)

Definition at line 1346 of file heaptuple.c.

1348{
1349 HeapTupleHeader tup = tuple->t_data;
1350 bool hasnulls = HeapTupleHasNulls(tuple);
1351 int tdesc_natts = tupleDesc->natts;
1352 int natts; /* number of atts to extract */
1353 int attnum;
1354 char *tp; /* ptr to tuple data */
1355 uint32 off; /* offset in tuple data */
1356 bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */
1357 bool slow = false; /* can we use/set attcacheoff? */
1358
1359 natts = HeapTupleHeaderGetNatts(tup);
1360
1361 /*
1362 * In inheritance situations, it is possible that the given tuple actually
1363 * has more fields than the caller is expecting. Don't run off the end of
1364 * the caller's arrays.
1365 */
1366 natts = Min(natts, tdesc_natts);
1367
1368 tp = (char *) tup + tup->t_hoff;
1369
1370 off = 0;
1371
1372 for (attnum = 0; attnum < natts; attnum++)
1373 {
1374 CompactAttribute *thisatt = TupleDescCompactAttr(tupleDesc, attnum);
1375
1376 if (hasnulls && att_isnull(attnum, bp))
1377 {
1378 values[attnum] = (Datum) 0;
1379 isnull[attnum] = true;
1380 slow = true; /* can't use attcacheoff anymore */
1381 continue;
1382 }
1383
1384 isnull[attnum] = false;
1385
1386 if (!slow && thisatt->attcacheoff >= 0)
1387 off = thisatt->attcacheoff;
1388 else if (thisatt->attlen == -1)
1389 {
1390 /*
1391 * We can only cache the offset for a varlena attribute if the
1392 * offset is already suitably aligned, so that there would be no
1393 * pad bytes in any case: then the offset will be valid for either
1394 * an aligned or unaligned value.
1395 */
1396 if (!slow &&
1397 off == att_nominal_alignby(off, thisatt->attalignby))
1398 thisatt->attcacheoff = off;
1399 else
1400 {
1401 off = att_pointer_alignby(off, thisatt->attalignby, -1,
1402 tp + off);
1403 slow = true;
1404 }
1405 }
1406 else
1407 {
1408 /* not varlena, so safe to use att_nominal_alignby */
1409 off = att_nominal_alignby(off, thisatt->attalignby);
1410
1411 if (!slow)
1412 thisatt->attcacheoff = off;
1413 }
1414
1415 values[attnum] = fetchatt(thisatt, tp + off);
1416
1417 off = att_addlength_pointer(off, thisatt->attlen, tp + off);
1418
1419 if (thisatt->attlen <= 0)
1420 slow = true; /* can't use attcacheoff anymore */
1421 }
1422
1423 /*
1424 * If tuple doesn't have all the atts indicated by tupleDesc, read the
1425 * rest as nulls or missing values as appropriate.
1426 */
1427 for (; attnum < tdesc_natts; attnum++)
1428 values[attnum] = getmissingattr(tupleDesc, attnum + 1, &isnull[attnum]);
1429}
#define Min(x, y)
Definition: c.h:961
uint8 bits8
Definition: c.h:495
uint32_t uint32
Definition: c.h:488
for(;;)
Datum getmissingattr(TupleDesc tupleDesc, int attnum, bool *isnull)
Definition: heaptuple.c:151
static bool HeapTupleHasNulls(const HeapTupleData *tuple)
Definition: htup_details.h:738
#define att_addlength_pointer(cur_offset, attlen, attptr)
Definition: tupmacs.h:185
#define att_pointer_alignby(cur_offset, attalignby, attlen, attptr)
Definition: tupmacs.h:129

References att_addlength_pointer, att_isnull(), att_nominal_alignby, att_pointer_alignby, CompactAttribute::attalignby, CompactAttribute::attcacheoff, CompactAttribute::attlen, attnum, fetchatt, for(), HeapTupleHasNulls(), HeapTupleHeaderGetNatts, Min, TupleDescData::natts, HeapTupleHeaderData::t_bits, HeapTupleData::t_data, HeapTupleHeaderData::t_hoff, TupleDescCompactAttr(), and values.

Referenced by attribute_statistics_update(), deconstruct_expanded_record(), exec_move_row(), ExecEvalFieldStoreDeForm(), ExecForceStoreHeapTuple(), ExecForceStoreMinimalTuple(), ExecStoreHeapTupleDatum(), execute_attr_map_tuple(), ExtractReplicaIdentity(), hash_record(), hash_record_extended(), heap_modify_tuple(), heap_modify_tuple_by_cols(), heap_toast_delete(), heap_toast_insert_or_update(), hstore_from_record(), hstore_populate_record(), make_tuple_indirect(), populate_record(), record_cmp(), record_eq(), record_image_cmp(), record_image_eq(), record_out(), record_send(), reform_and_rewrite_tuple(), ReorderBufferToastReplace(), RI_Initial_Check(), RI_PartitionRemove_Check(), SPI_modifytuple(), toast_flatten_tuple(), and toast_flatten_tuple_to_datum().

◆ heap_expand_tuple()

HeapTuple heap_expand_tuple ( HeapTuple  sourceTuple,
TupleDesc  tupleDesc 
)

Definition at line 1066 of file heaptuple.c.

1067{
1068 HeapTuple heapTuple;
1069
1070 expand_tuple(&heapTuple, NULL, sourceTuple, tupleDesc);
1071 return heapTuple;
1072}
static void expand_tuple(HeapTuple *targetHeapTuple, MinimalTuple *targetMinimalTuple, HeapTuple sourceTuple, TupleDesc tupleDesc)
Definition: heaptuple.c:830

References expand_tuple().

◆ heap_fill_tuple()

void heap_fill_tuple ( TupleDesc  tupleDesc,
const Datum values,
const bool *  isnull,
char *  data,
Size  data_size,
uint16 infomask,
bits8 bit 
)

Definition at line 401 of file heaptuple.c.

405{
406 bits8 *bitP;
407 int bitmask;
408 int i;
409 int numberOfAttributes = tupleDesc->natts;
410
411#ifdef USE_ASSERT_CHECKING
412 char *start = data;
413#endif
414
415 if (bit != NULL)
416 {
417 bitP = &bit[-1];
418 bitmask = HIGHBIT;
419 }
420 else
421 {
422 /* just to keep compiler quiet */
423 bitP = NULL;
424 bitmask = 0;
425 }
426
428
429 for (i = 0; i < numberOfAttributes; i++)
430 {
431 CompactAttribute *attr = TupleDescCompactAttr(tupleDesc, i);
432
433 fill_val(attr,
434 bitP ? &bitP : NULL,
435 &bitmask,
436 &data,
437 infomask,
438 values ? values[i] : PointerGetDatum(NULL),
439 isnull ? isnull[i] : true);
440 }
441
442 Assert((data - start) == data_size);
443}
#define HIGHBIT
Definition: c.h:1111
return str start
static void fill_val(CompactAttribute *att, bits8 **bit, int *bitmask, char **dataP, uint16 *infomask, Datum datum, bool isnull)
Definition: heaptuple.c:275
#define HEAP_HASVARWIDTH
Definition: htup_details.h:191
#define HEAP_HASNULL
Definition: htup_details.h:190
#define HEAP_HASEXTERNAL
Definition: htup_details.h:192
const void * data
Datum bit(PG_FUNCTION_ARGS)
Definition: varbit.c:391

References Assert, bit(), data, fill_val(), HEAP_HASEXTERNAL, HEAP_HASNULL, HEAP_HASVARWIDTH, HIGHBIT, i, TupleDescData::natts, PointerGetDatum(), start, TupleDescCompactAttr(), and values.

Referenced by brin_form_tuple(), ER_flatten_into(), heap_form_minimal_tuple(), heap_form_tuple(), heap_toast_insert_or_update(), index_form_tuple_context(), spgFormLeafTuple(), and toast_flatten_tuple_to_datum().

◆ heap_form_minimal_tuple()

MinimalTuple heap_form_minimal_tuple ( TupleDesc  tupleDescriptor,
const Datum values,
const bool *  isnull 
)

Definition at line 1453 of file heaptuple.c.

1456{
1457 MinimalTuple tuple; /* return tuple */
1458 Size len,
1459 data_len;
1460 int hoff;
1461 bool hasnull = false;
1462 int numberOfAttributes = tupleDescriptor->natts;
1463 int i;
1464
1465 if (numberOfAttributes > MaxTupleAttributeNumber)
1466 ereport(ERROR,
1467 (errcode(ERRCODE_TOO_MANY_COLUMNS),
1468 errmsg("number of columns (%d) exceeds limit (%d)",
1469 numberOfAttributes, MaxTupleAttributeNumber)));
1470
1471 /*
1472 * Check for nulls
1473 */
1474 for (i = 0; i < numberOfAttributes; i++)
1475 {
1476 if (isnull[i])
1477 {
1478 hasnull = true;
1479 break;
1480 }
1481 }
1482
1483 /*
1484 * Determine total space needed
1485 */
1487
1488 if (hasnull)
1489 len += BITMAPLEN(numberOfAttributes);
1490
1491 hoff = len = MAXALIGN(len); /* align user data safely */
1492
1493 data_len = heap_compute_data_size(tupleDescriptor, values, isnull);
1494
1495 len += data_len;
1496
1497 /*
1498 * Allocate and zero the space needed.
1499 */
1500 tuple = (MinimalTuple) palloc0(len);
1501
1502 /*
1503 * And fill in the information.
1504 */
1505 tuple->t_len = len;
1506 HeapTupleHeaderSetNatts(tuple, numberOfAttributes);
1507 tuple->t_hoff = hoff + MINIMAL_TUPLE_OFFSET;
1508
1509 heap_fill_tuple(tupleDescriptor,
1510 values,
1511 isnull,
1512 (char *) tuple + hoff,
1513 data_len,
1514 &tuple->t_infomask,
1515 (hasnull ? tuple->t_bits : NULL));
1516
1517 return tuple;
1518}
int errcode(int sqlerrcode)
Definition: elog.c:853
int errmsg(const char *fmt,...)
Definition: elog.c:1070
#define ereport(elevel,...)
Definition: elog.h:149
Size heap_compute_data_size(TupleDesc tupleDesc, const Datum *values, const bool *isnull)
Definition: heaptuple.c:219
void heap_fill_tuple(TupleDesc tupleDesc, const Datum *values, const bool *isnull, char *data, Size data_size, uint16 *infomask, bits8 *bit)
Definition: heaptuple.c:401
#define MINIMAL_TUPLE_OFFSET
Definition: htup_details.h:669
static int BITMAPLEN(int NATTS)
Definition: htup_details.h:594
#define SizeofMinimalTupleHeader
Definition: htup_details.h:699
#define MaxTupleAttributeNumber
Definition: htup_details.h:34
#define HeapTupleHeaderSetNatts(tup, natts)
Definition: htup_details.h:580
void * palloc0(Size size)
Definition: mcxt.c:1347
const void size_t len
bits8 t_bits[FLEXIBLE_ARRAY_MEMBER]
Definition: htup_details.h:692

References BITMAPLEN(), ereport, errcode(), errmsg(), ERROR, heap_compute_data_size(), heap_fill_tuple(), HeapTupleHeaderSetNatts, i, len, MAXALIGN, MaxTupleAttributeNumber, MINIMAL_TUPLE_OFFSET, TupleDescData::natts, palloc0(), SizeofMinimalTupleHeader, MinimalTupleData::t_bits, MinimalTupleData::t_hoff, MinimalTupleData::t_infomask, MinimalTupleData::t_len, and values.

Referenced by tts_minimal_materialize(), tts_virtual_copy_minimal_tuple(), and tuplestore_putvalues().

◆ heap_form_tuple()

HeapTuple heap_form_tuple ( TupleDesc  tupleDescriptor,
const Datum values,
const bool *  isnull 
)

Definition at line 1117 of file heaptuple.c.

1120{
1121 HeapTuple tuple; /* return tuple */
1122 HeapTupleHeader td; /* tuple data */
1123 Size len,
1124 data_len;
1125 int hoff;
1126 bool hasnull = false;
1127 int numberOfAttributes = tupleDescriptor->natts;
1128 int i;
1129
1130 if (numberOfAttributes > MaxTupleAttributeNumber)
1131 ereport(ERROR,
1132 (errcode(ERRCODE_TOO_MANY_COLUMNS),
1133 errmsg("number of columns (%d) exceeds limit (%d)",
1134 numberOfAttributes, MaxTupleAttributeNumber)));
1135
1136 /*
1137 * Check for nulls
1138 */
1139 for (i = 0; i < numberOfAttributes; i++)
1140 {
1141 if (isnull[i])
1142 {
1143 hasnull = true;
1144 break;
1145 }
1146 }
1147
1148 /*
1149 * Determine total space needed
1150 */
1151 len = offsetof(HeapTupleHeaderData, t_bits);
1152
1153 if (hasnull)
1154 len += BITMAPLEN(numberOfAttributes);
1155
1156 hoff = len = MAXALIGN(len); /* align user data safely */
1157
1158 data_len = heap_compute_data_size(tupleDescriptor, values, isnull);
1159
1160 len += data_len;
1161
1162 /*
1163 * Allocate and zero the space needed. Note that the tuple body and
1164 * HeapTupleData management structure are allocated in one chunk.
1165 */
1166 tuple = (HeapTuple) palloc0(HEAPTUPLESIZE + len);
1167 tuple->t_data = td = (HeapTupleHeader) ((char *) tuple + HEAPTUPLESIZE);
1168
1169 /*
1170 * And fill in the information. Note we fill the Datum fields even though
1171 * this tuple may never become a Datum. This lets HeapTupleHeaderGetDatum
1172 * identify the tuple type if needed.
1173 */
1174 tuple->t_len = len;
1175 ItemPointerSetInvalid(&(tuple->t_self));
1176 tuple->t_tableOid = InvalidOid;
1177
1179 HeapTupleHeaderSetTypeId(td, tupleDescriptor->tdtypeid);
1180 HeapTupleHeaderSetTypMod(td, tupleDescriptor->tdtypmod);
1181 /* We also make sure that t_ctid is invalid unless explicitly set */
1183
1184 HeapTupleHeaderSetNatts(td, numberOfAttributes);
1185 td->t_hoff = hoff;
1186
1187 heap_fill_tuple(tupleDescriptor,
1188 values,
1189 isnull,
1190 (char *) td + hoff,
1191 data_len,
1192 &td->t_infomask,
1193 (hasnull ? td->t_bits : NULL));
1194
1195 return tuple;
1196}
static void ItemPointerSetInvalid(ItemPointerData *pointer)
Definition: itemptr.h:184
#define InvalidOid
Definition: postgres_ext.h:37
ItemPointerData t_ctid
Definition: htup_details.h:161

References BITMAPLEN(), ereport, errcode(), errmsg(), ERROR, heap_compute_data_size(), heap_fill_tuple(), HeapTupleHeaderSetDatumLength(), HeapTupleHeaderSetNatts, HeapTupleHeaderSetTypeId(), HeapTupleHeaderSetTypMod(), HEAPTUPLESIZE, i, InvalidOid, ItemPointerSetInvalid(), len, MAXALIGN, MaxTupleAttributeNumber, TupleDescData::natts, palloc0(), HeapTupleHeaderData::t_bits, HeapTupleHeaderData::t_ctid, HeapTupleData::t_data, HeapTupleHeaderData::t_hoff, HeapTupleHeaderData::t_infomask, HeapTupleData::t_len, HeapTupleData::t_self, HeapTupleData::t_tableOid, TupleDescData::tdtypeid, TupleDescData::tdtypmod, and values.

Referenced by aclexplode(), AddEnumLabel(), AddRoleMems(), AddSubscriptionRelState(), AggregateCreate(), AlterSetting(), brin_metapage_info(), bt_page_print_tuples(), BuildTupleFromCStrings(), CastCreate(), CollationCreate(), ConversionCreate(), copy_replication_slot(), CreateAccessMethod(), CreateComments(), CreateConstraintEntry(), createdb(), CreateForeignDataWrapper(), CreateForeignServer(), CreateForeignTable(), CreateOpFamily(), CreatePolicy(), CreateProceduralLanguage(), CreatePublication(), CreateRole(), CreateSharedComments(), CreateStatistics(), CreateSubscription(), CreateTableSpace(), CreateTransform(), CreateTriggerFiringOn(), CreateUserMapping(), DefineOpClass(), DefineSequence(), DefineTSConfiguration(), DefineTSDictionary(), DefineTSParser(), DefineTSTemplate(), each_object_field_end(), elements_array_element_end(), ExecEvalFieldStoreForm(), ExecEvalRow(), execute_attr_map_tuple(), expanded_record_get_tuple(), ExtractReplicaIdentity(), file_acquire_sample_rows(), fill_hba_line(), fill_ident_line(), gin_leafpage_items(), gin_metapage_info(), gin_page_opaque_info(), gist_page_opaque_info(), gistFetchTuple(), hash_bitmap_info(), hash_metapage_info(), hash_page_items(), hash_page_stats(), heap_modify_tuple(), heap_modify_tuple_by_cols(), heap_page_items(), heap_tuple_infomask_flags(), hstore_each(), hstore_populate_record(), injection_points_stats_fixed(), insert_event_trigger_tuple(), InsertExtensionTuple(), InsertOneTuple(), InsertPgClassTuple(), InsertRule(), inv_truncate(), inv_write(), LargeObjectCreate(), make_tuple_from_result_row(), make_tuple_from_row(), make_tuple_indirect(), NamespaceCreate(), OperatorCreate(), OperatorShellMake(), page_header(), ParameterAclCreate(), pg_available_wal_summaries(), pg_backup_stop(), pg_buffercache_pages(), pg_buffercache_summary(), pg_control_checkpoint(), pg_control_init(), pg_control_recovery(), pg_control_system(), pg_create_logical_replication_slot(), pg_create_physical_replication_slot(), pg_get_catalog_foreign_keys(), pg_get_logical_snapshot_info(), pg_get_logical_snapshot_meta(), pg_get_object_address(), pg_get_publication_tables(), pg_get_sequence_data(), pg_get_wal_record_info(), pg_get_wal_summarizer_state(), pg_identify_object(), pg_identify_object_as_address(), pg_input_error_info(), pg_last_committed_xact(), pg_lock_status(), pg_partition_tree(), pg_prepared_xact(), pg_replication_slot_advance(), pg_sequence_parameters(), pg_split_walfile_name(), pg_stat_file(), pg_stat_get_archiver(), pg_stat_get_backend_subxact(), pg_stat_get_replication_slot(), pg_stat_get_subscription_stats(), pg_stat_get_wal(), pg_stat_get_wal_receiver(), pg_stat_statements_info(), pg_stats_ext_mcvlist_items(), pg_timezone_abbrevs_abbrevs(), pg_timezone_abbrevs_zone(), pg_visibility(), pg_visibility_map(), pg_visibility_map_rel(), pg_visibility_map_summary(), pg_visibility_rel(), pg_wal_summary_contents(), pg_walfile_name_offset(), pg_xact_commit_timestamp_origin(), pgstatginindex_internal(), pgstathashindex(), pgstattuple_approx_internal(), plperl_build_tuple_result(), PLyGenericObject_ToComposite(), PLyMapping_ToComposite(), PLySequence_ToComposite(), populate_record(), ProcedureCreate(), publication_add_relation(), publication_add_schema(), RangeCreate(), record_in(), record_recv(), recordExtensionInitPrivWorker(), reform_and_rewrite_tuple(), ReorderBufferToastReplace(), replorigin_create(), report_corruption_internal(), serialize_expr_stats(), SetDefaultACL(), SetSecurityLabel(), SetSharedSecurityLabel(), shdepAddDependency(), shdepChangeDep(), SPI_modifytuple(), ssl_extension_info(), statext_store(), StoreAttrDefault(), storeGettuple(), storeOperators(), StorePartitionKey(), storeProcedures(), StoreSingleInheritance(), test_enc_conversion(), test_predtest(), toast_build_flattened_tuple(), toast_flatten_tuple(), toast_save_datum(), tsvector_unnest(), tts_buffer_heap_materialize(), tts_heap_materialize(), tts_virtual_copy_heap_tuple(), TypeCreate(), TypeShellMake(), update_attstats(), UpdateIndexRelation(), and upsert_pg_statistic().

◆ heap_free_minimal_tuple()

void heap_free_minimal_tuple ( MinimalTuple  mtup)

◆ heap_freetuple()

void heap_freetuple ( HeapTuple  htup)

Definition at line 1435 of file heaptuple.c.

1436{
1437 pfree(htup);
1438}

References pfree().

Referenced by acquire_inherited_sample_rows(), acquire_sample_rows(), AddEnumLabel(), AddSubscriptionRelState(), AfterTriggerExecute(), AlterCollation(), AlterConstrTriggerDeferrability(), AlterDatabaseOwner(), AlterDatabaseRefreshColl(), AlterDomainDefault(), AlterDomainNotNull(), AlterDomainValidateConstraint(), AlterEventTrigger(), AlterEventTriggerOwner(), AlterEventTriggerOwner_oid(), AlterForeignDataWrapper(), AlterForeignDataWrapperOwner(), AlterForeignDataWrapperOwner_oid(), AlterForeignServer(), AlterForeignServerOwner(), AlterForeignServerOwner_oid(), AlterFunction(), AlterObjectRename_internal(), AlterPolicy(), AlterPublication(), AlterPublicationOwner(), AlterPublicationOwner_oid(), AlterRelationNamespaceInternal(), AlterRole(), AlterSchemaOwner_internal(), AlterStatistics(), AlterSubscription(), AlterSubscriptionOwner(), AlterSubscriptionOwner_oid(), AlterTableSpaceOptions(), AlterTSDictionary(), AlterTypeNamespaceInternal(), AlterUserMapping(), analyze_row_processor(), ATExecAddColumn(), ATExecAddIdentity(), ATExecAddOf(), ATExecAlterColumnGenericOptions(), ATExecAlterColumnType(), ATExecAlterConstrRecurse(), ATExecChangeOwner(), ATExecDropColumn(), ATExecDropExpression(), ATExecDropIdentity(), ATExecDropNotNull(), ATExecDropOf(), ATExecForceNoForceRowSecurity(), ATExecGenericOptions(), ATExecSetAccessMethodNoStorage(), ATExecSetCompression(), ATExecSetIdentity(), ATExecSetOptions(), ATExecSetRelOptions(), ATExecSetRowSecurity(), ATExecSetStatistics(), ATExecSetStorage(), build_tuplestore_recursively(), CastCreate(), CatalogCacheCreateEntry(), CatalogTuplesMultiInsertWithInfo(), change_owner_fix_column_acls(), changeDependenciesOf(), changeDependenciesOn(), changeDependencyFor(), clear_subscription_skip_lsn(), CollationCreate(), ConversionCreate(), copy_table_data(), CopyStatistics(), create_toast_table(), CreateAccessMethod(), CreateComments(), CreateForeignDataWrapper(), CreateForeignServer(), CreateForeignTable(), CreateOpFamily(), CreatePolicy(), CreatePublication(), CreateSharedComments(), CreateStatistics(), CreateSubscription(), CreateTableSpace(), CreateTransform(), CreateTriggerFiringOn(), CreateUserMapping(), crosstab(), DefineIndex(), DefineOpClass(), DefineSequence(), DefineTSConfiguration(), DefineTSDictionary(), DefineTSParser(), DefineTSTemplate(), DetachPartitionFinalize(), DisableSubscription(), dropconstraint_internal(), dropdb(), EnableDisableRule(), EnableDisableTrigger(), EventTriggerOnLogin(), examine_attribute(), examine_expression(), ExecBRDeleteTriggers(), ExecBRInsertTriggers(), ExecBRUpdateTriggers(), ExecIRDeleteTriggers(), ExecIRInsertTriggers(), ExecIRUpdateTriggers(), ExecReScanAgg(), ExecReScanIndexScan(), ExecScanSubPlan(), ExecSetParamPlan(), expanded_record_set_tuple(), ExtractReplicaIdentity(), file_acquire_sample_rows(), heap_delete(), heap_insert(), heap_update(), index_build(), index_concurrently_swap(), index_constraint_create(), index_update_stats(), insert_event_trigger_tuple(), InsertExtensionTuple(), InsertOneTuple(), InsertPgClassTuple(), InsertRule(), inv_truncate(), inv_write(), LargeObjectCreate(), mark_index_clustered(), MarkInheritDetached(), MergeAttributesIntoExisting(), MergeConstraintsIntoExisting(), OperatorShellMake(), ParameterAclCreate(), PLyGenericObject_ToComposite(), PLyMapping_ToComposite(), PLySequence_ToComposite(), ProcedureCreate(), publication_add_relation(), publication_add_schema(), QueueCheckConstraintValidation(), QueueFKConstraintValidation(), RangeCreate(), raw_heap_insert(), record_in(), record_recv(), reform_and_rewrite_tuple(), relation_mark_replica_identity(), relation_statistics_update(), RelationBuildDesc(), RelationClearMissing(), RelationInitPhysicalAddr(), RelationReloadIndexInfo(), RelationReloadNailed(), RelationSetNewRelfilenumber(), RemoveConstraintById(), RemoveInheritance(), RemoveRoleFromObjectPolicy(), renameatt_internal(), RenameConstraintById(), RenameEnumLabel(), RenameRelationInternal(), RenameRewriteRule(), RenameSchema(), RenameTypeInternal(), RenumberEnumType(), replorigin_create(), ResetRelRewrite(), rewrite_heap_dead_tuple(), rewrite_heap_tuple(), set_attnotnull(), SetDatabaseHasLoginEventTriggers(), SetIndexStorageProperties(), SetMatViewPopulatedState(), SetRelationHasSubclass(), SetRelationNumChecks(), SetRelationRuleStatus(), SetRelationTableSpace(), SetSecurityLabel(), SetSharedSecurityLabel(), shdepAddDependency(), shdepChangeDep(), SPI_freetuple(), statext_store(), StoreAttrDefault(), storeOperators(), StorePartitionBound(), storeProcedures(), StoreSingleInheritance(), swap_relation_files(), table_recheck_autovac(), toast_save_datum(), TriggerSetParentTrigger(), tts_buffer_heap_clear(), tts_buffer_heap_store_tuple(), tts_heap_clear(), TypeShellMake(), update_attstats(), update_default_partition_oid(), update_relispartition(), UpdateIndexRelation(), UpdateTwoPhaseState(), upsert_pg_statistic(), vac_update_datfrozenxid(), validatePartitionedIndex(), and xpath_table().

◆ heap_getattr()

static Datum heap_getattr ( HeapTuple  tup,
int  attnum,
TupleDesc  tupleDesc,
bool *  isnull 
)
inlinestatic

Definition at line 903 of file htup_details.h.

909{
910 if (attnum > 0)
911 {
912 if (attnum > (int) HeapTupleHeaderGetNatts(tup->t_data))
913 return getmissingattr(tupleDesc, attnum, isnull);
914 else
Datum getmissingattr(TupleDesc tupleDesc, int attnum, bool *isnull)
Definition: heaptuple.c:151

References attnum, fastgetattr(), getmissingattr(), heap_getsysattr(), HeapTupleHeaderGetNatts, and HeapTupleData::t_data.

Referenced by AlterDatabaseOwner(), AlterDatabaseRefreshColl(), AlterForeignDataWrapperOwner_internal(), AlterForeignServerOwner_internal(), AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), AlterPolicy(), AlterSetting(), AlterTableSpaceOptions(), AlterTypeOwnerInternal(), ApplySetting(), ATExecAlterColumnType(), BuildEventTriggerCache(), CatalogCacheCreateEntry(), change_owner_fix_column_acls(), CloneRowTriggersToPartition(), comparetup_cluster_tiebreak(), comparetup_heap_tiebreak(), composite_to_json(), composite_to_jsonb(), decompile_conbin(), EventTriggerSQLDropAddObject(), ExecAlterExtensionStmt(), ExecEvalFieldSelect(), ExecGrant_Largeobject(), ExecScanSubPlan(), ExecSetParamPlan(), extension_config_remove(), GenerateTypeDependencies(), get_primary_key_attnos(), get_relation_constraint_attnos(), GetAttributeByName(), GetAttributeByNum(), GetComment(), GetSecurityLabel(), GetSharedSecurityLabel(), GetSysCacheOid(), HeapDetermineColumnsInfo(), HeapKeyTest(), make_build_data(), object_ownercheck(), pg_event_trigger_ddl_commands(), pg_extension_config_dump(), pg_get_acl(), pg_identify_object(), pg_largeobject_aclmask_snapshot(), plperl_hash_from_tuple(), pltcl_build_tuple_argument(), pltcl_set_tuple_values(), PLyDict_FromTuple(), readtup_cluster(), readtup_heap(), recordExtensionInitPrivWorker(), recordExtObjInitPriv(), RelationBuildPartitionDesc(), RelationBuildRowSecurity(), RelationBuildRuleLock(), RelationBuildTupleDesc(), RelationGetDummyIndexExpressions(), RelationGetIndexAttrBitmap(), RelationGetIndexExpressions(), RelationGetIndexPredicate(), removeabbrev_cluster(), removeabbrev_heap(), RemoveRoleFromInitPriv(), RemoveRoleFromObjectPolicy(), RenameRole(), ReplaceRoleInInitPriv(), sepgsql_relation_setattr_extra(), SPI_getbinval(), SPI_getvalue(), std_fetch_func(), SysCacheGetAttr(), tuple_to_stringinfo(), tuplesort_putheaptuple(), and tuplesort_puttupleslot().

◆ heap_getsysattr()

Datum heap_getsysattr ( HeapTuple  tup,
int  attnum,
TupleDesc  tupleDesc,
bool *  isnull 
)

Definition at line 725 of file heaptuple.c.

726{
727 Datum result;
728
729 Assert(tup);
730
731 /* Currently, no sys attribute ever reads as NULL. */
732 *isnull = false;
733
734 switch (attnum)
735 {
737 /* pass-by-reference datatype */
738 result = PointerGetDatum(&(tup->t_self));
739 break;
742 break;
745 break;
748
749 /*
750 * cmin and cmax are now both aliases for the same field, which
751 * can in fact also be a combo command id. XXX perhaps we should
752 * return the "real" cmin or cmax if possible, that is if we are
753 * inside the originating transaction?
754 */
756 break;
758 result = ObjectIdGetDatum(tup->t_tableOid);
759 break;
760 default:
761 elog(ERROR, "invalid attnum: %d", attnum);
762 result = 0; /* keep compiler quiet */
763 break;
764 }
765 return result;
766}
static CommandId HeapTupleHeaderGetRawCommandId(const HeapTupleHeaderData *tup)
Definition: htup_details.h:415
static TransactionId HeapTupleHeaderGetRawXmax(const HeapTupleHeaderData *tup)
Definition: htup_details.h:377
static TransactionId HeapTupleHeaderGetRawXmin(const HeapTupleHeaderData *tup)
Definition: htup_details.h:318
static Datum TransactionIdGetDatum(TransactionId X)
Definition: postgres.h:277
static Datum CommandIdGetDatum(CommandId X)
Definition: postgres.h:307
static Datum ObjectIdGetDatum(Oid X)
Definition: postgres.h:257

References Assert, attnum, CommandIdGetDatum(), elog, ERROR, HeapTupleHeaderGetRawCommandId(), HeapTupleHeaderGetRawXmax(), HeapTupleHeaderGetRawXmin(), MaxCommandIdAttributeNumber, MaxTransactionIdAttributeNumber, MinCommandIdAttributeNumber, MinTransactionIdAttributeNumber, ObjectIdGetDatum(), PointerGetDatum(), SelfItemPointerAttributeNumber, HeapTupleData::t_data, HeapTupleData::t_self, HeapTupleData::t_tableOid, TableOidAttributeNumber, and TransactionIdGetDatum().

Referenced by expanded_record_fetch_field(), heap_getattr(), tts_buffer_heap_getsysattr(), and tts_heap_getsysattr().

◆ HEAP_LOCKED_UPGRADED()

◆ heap_modify_tuple()

HeapTuple heap_modify_tuple ( HeapTuple  tuple,
TupleDesc  tupleDesc,
const Datum replValues,
const bool *  replIsnull,
const bool *  doReplace 
)

Definition at line 1210 of file heaptuple.c.

1215{
1216 int numberOfAttributes = tupleDesc->natts;
1217 int attoff;
1218 Datum *values;
1219 bool *isnull;
1220 HeapTuple newTuple;
1221
1222 /*
1223 * allocate and fill values and isnull arrays from either the tuple or the
1224 * repl information, as appropriate.
1225 *
1226 * NOTE: it's debatable whether to use heap_deform_tuple() here or just
1227 * heap_getattr() only the non-replaced columns. The latter could win if
1228 * there are many replaced columns and few non-replaced ones. However,
1229 * heap_deform_tuple costs only O(N) while the heap_getattr way would cost
1230 * O(N^2) if there are many non-replaced columns, so it seems better to
1231 * err on the side of linear cost.
1232 */
1233 values = (Datum *) palloc(numberOfAttributes * sizeof(Datum));
1234 isnull = (bool *) palloc(numberOfAttributes * sizeof(bool));
1235
1236 heap_deform_tuple(tuple, tupleDesc, values, isnull);
1237
1238 for (attoff = 0; attoff < numberOfAttributes; attoff++)
1239 {
1240 if (doReplace[attoff])
1241 {
1242 values[attoff] = replValues[attoff];
1243 isnull[attoff] = replIsnull[attoff];
1244 }
1245 }
1246
1247 /*
1248 * create a new tuple from the values and isnull arrays
1249 */
1250 newTuple = heap_form_tuple(tupleDesc, values, isnull);
1251
1252 pfree(values);
1253 pfree(isnull);
1254
1255 /*
1256 * copy the identification info of the old tuple: t_ctid, t_self
1257 */
1258 newTuple->t_data->t_ctid = tuple->t_data->t_ctid;
1259 newTuple->t_self = tuple->t_self;
1260 newTuple->t_tableOid = tuple->t_tableOid;
1261
1262 return newTuple;
1263}
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
Definition: heaptuple.c:1117
void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *values, bool *isnull)
Definition: heaptuple.c:1346

References heap_deform_tuple(), heap_form_tuple(), TupleDescData::natts, palloc(), pfree(), HeapTupleHeaderData::t_ctid, HeapTupleData::t_data, HeapTupleData::t_self, HeapTupleData::t_tableOid, and values.

Referenced by AddRoleMems(), AggregateCreate(), AlterCollation(), AlterDatabase(), AlterDatabaseOwner(), AlterDatabaseRefreshColl(), AlterDomainDefault(), AlterForeignDataWrapper(), AlterForeignDataWrapperOwner_internal(), AlterForeignServer(), AlterForeignServerOwner_internal(), AlterFunction(), AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), AlterOperator(), AlterPolicy(), AlterPublicationOptions(), AlterRole(), AlterSchemaOwner_internal(), AlterSetting(), AlterStatistics(), AlterSubscription(), AlterTableSpaceOptions(), AlterTSDictionary(), AlterTypeOwnerInternal(), AlterTypeRecurse(), AlterUserMapping(), ApplyExtensionUpdates(), ATExecAlterColumnGenericOptions(), ATExecAlterColumnType(), ATExecChangeOwner(), ATExecGenericOptions(), ATExecSetOptions(), ATExecSetRelOptions(), ATExecSetStatistics(), change_owner_fix_column_acls(), clear_subscription_skip_lsn(), CreateComments(), CreateProceduralLanguage(), CreateSharedComments(), CreateTransform(), DelRoleMems(), DetachPartitionFinalize(), DisableSubscription(), ExecGrant_Attribute(), ExecGrant_common(), ExecGrant_Largeobject(), ExecGrant_Parameter(), ExecGrant_Relation(), extension_config_remove(), index_concurrently_swap(), InsertRule(), inv_truncate(), inv_write(), MakeConfigurationMapping(), movedb(), OperatorCreate(), pg_extension_config_dump(), plperl_modify_tuple(), PLy_modify_tuple(), ProcedureCreate(), recordExtensionInitPrivWorker(), RelationClearMissing(), RemoveAttributeById(), RemoveRoleFromInitPriv(), RemoveRoleFromObjectPolicy(), RenameRole(), ReplaceRoleInInitPriv(), SetAttrMissing(), SetDefaultACL(), SetSecurityLabel(), SetSharedSecurityLabel(), StoreAttrDefault(), StorePartitionBound(), TypeCreate(), update_attstats(), UpdateSubscriptionRelState(), UpdateTwoPhaseState(), and upsert_pg_statistic().

◆ heap_modify_tuple_by_cols()

HeapTuple heap_modify_tuple_by_cols ( HeapTuple  tuple,
TupleDesc  tupleDesc,
int  nCols,
const int *  replCols,
const Datum replValues,
const bool *  replIsnull 
)

Definition at line 1278 of file heaptuple.c.

1284{
1285 int numberOfAttributes = tupleDesc->natts;
1286 Datum *values;
1287 bool *isnull;
1288 HeapTuple newTuple;
1289 int i;
1290
1291 /*
1292 * allocate and fill values and isnull arrays from the tuple, then replace
1293 * selected columns from the input arrays.
1294 */
1295 values = (Datum *) palloc(numberOfAttributes * sizeof(Datum));
1296 isnull = (bool *) palloc(numberOfAttributes * sizeof(bool));
1297
1298 heap_deform_tuple(tuple, tupleDesc, values, isnull);
1299
1300 for (i = 0; i < nCols; i++)
1301 {
1302 int attnum = replCols[i];
1303
1304 if (attnum <= 0 || attnum > numberOfAttributes)
1305 elog(ERROR, "invalid column number %d", attnum);
1306 values[attnum - 1] = replValues[i];
1307 isnull[attnum - 1] = replIsnull[i];
1308 }
1309
1310 /*
1311 * create a new tuple from the values and isnull arrays
1312 */
1313 newTuple = heap_form_tuple(tupleDesc, values, isnull);
1314
1315 pfree(values);
1316 pfree(isnull);
1317
1318 /*
1319 * copy the identification info of the old tuple: t_ctid, t_self
1320 */
1321 newTuple->t_data->t_ctid = tuple->t_data->t_ctid;
1322 newTuple->t_self = tuple->t_self;
1323 newTuple->t_tableOid = tuple->t_tableOid;
1324
1325 return newTuple;
1326}

References attnum, elog, ERROR, heap_deform_tuple(), heap_form_tuple(), i, TupleDescData::natts, palloc(), pfree(), HeapTupleHeaderData::t_ctid, HeapTupleData::t_data, HeapTupleData::t_self, HeapTupleData::t_tableOid, and values.

Referenced by autoinc(), check_modified_virtual_generated(), insert_username(), moddatetime(), relation_statistics_update(), and tsvector_update_trigger().

◆ heap_tuple_from_minimal_tuple()

HeapTuple heap_tuple_from_minimal_tuple ( MinimalTuple  mtup)

Definition at line 1555 of file heaptuple.c.

1556{
1557 HeapTuple result;
1559
1560 result = (HeapTuple) palloc(HEAPTUPLESIZE + len);
1561 result->t_len = len;
1562 ItemPointerSetInvalid(&(result->t_self));
1563 result->t_tableOid = InvalidOid;
1564 result->t_data = (HeapTupleHeader) ((char *) result + HEAPTUPLESIZE);
1565 memcpy((char *) result->t_data + MINIMAL_TUPLE_OFFSET, mtup, mtup->t_len);
1566 memset(result->t_data, 0, offsetof(HeapTupleHeaderData, t_infomask2));
1567 return result;
1568}

References HEAPTUPLESIZE, InvalidOid, ItemPointerSetInvalid(), len, MINIMAL_TUPLE_OFFSET, palloc(), HeapTupleData::t_data, HeapTupleData::t_len, MinimalTupleData::t_len, HeapTupleData::t_self, and HeapTupleData::t_tableOid.

Referenced by tts_minimal_copy_heap_tuple().

◆ HEAP_XMAX_IS_EXCL_LOCKED()

static bool HEAP_XMAX_IS_EXCL_LOCKED ( int16  infomask)
inlinestatic

◆ HEAP_XMAX_IS_KEYSHR_LOCKED()

static bool HEAP_XMAX_IS_KEYSHR_LOCKED ( int16  infomask)
inlinestatic

◆ HEAP_XMAX_IS_LOCKED_ONLY()

◆ HEAP_XMAX_IS_SHR_LOCKED()

static bool HEAP_XMAX_IS_SHR_LOCKED ( int16  infomask)
inlinestatic

◆ HeapTupleAllFixed()

static bool HeapTupleAllFixed ( const HeapTupleData tuple)
inlinestatic

Definition at line 756 of file htup_details.h.

756{
757 return (tuple->t_data->t_infomask & HEAP_HASVARWIDTH) != 0;
758}
759

References HEAP_HASVARWIDTH, HeapTupleData::t_data, and HeapTupleHeaderData::t_infomask.

◆ HeapTupleClearHeapOnly()

static void HeapTupleClearHeapOnly ( const HeapTupleData tuple)
inlinestatic

Definition at line 798 of file htup_details.h.

798{
800}
801
static void HeapTupleHeaderSetHeapOnly(HeapTupleHeaderData *tup)
Definition: htup_details.h:561

References HeapTupleHeaderSetHeapOnly(), and HeapTupleData::t_data.

Referenced by heap_update().

◆ HeapTupleClearHotUpdated()

static void HeapTupleClearHotUpdated ( const HeapTupleData tuple)
inlinestatic

Definition at line 780 of file htup_details.h.

780{
782}
783
static void HeapTupleHeaderSetHotUpdated(HeapTupleHeaderData *tup)
Definition: htup_details.h:543

References HeapTupleHeaderSetHotUpdated(), and HeapTupleData::t_data.

Referenced by heap_update().

◆ HeapTupleHasExternal()

static bool HeapTupleHasExternal ( const HeapTupleData tuple)
inlinestatic

◆ HeapTupleHasNulls()

static bool HeapTupleHasNulls ( const HeapTupleData tuple)
inlinestatic

◆ HeapTupleHasVarWidth()

static bool HeapTupleHasVarWidth ( const HeapTupleData tuple)
inlinestatic

Definition at line 750 of file htup_details.h.

750{
751 return !HeapTupleHasNulls(tuple);
752}
753

References HeapTupleHasNulls().

Referenced by HeapTupleHasExternal(), and nocachegetattr().

◆ HeapTupleHeaderClearHeapOnly()

static void HeapTupleHeaderClearHeapOnly ( HeapTupleHeaderData tup)
inlinestatic

Definition at line 567 of file htup_details.h.

567{
569}
570
#define HEAP_ONLY_TUPLE
Definition: htup_details.h:291

References HEAP_ONLY_TUPLE, and HeapTupleHeaderData::t_infomask2.

◆ HeapTupleHeaderClearHotUpdated()

static void HeapTupleHeaderClearHotUpdated ( HeapTupleHeaderData tup)
inlinestatic

◆ HeapTupleHeaderClearMatch()

static void HeapTupleHeaderClearMatch ( MinimalTupleData tup)
inlinestatic

◆ HeapTupleHeaderGetDatumLength()

◆ HeapTupleHeaderGetRawCommandId()

static CommandId HeapTupleHeaderGetRawCommandId ( const HeapTupleHeaderData tup)
inlinestatic

◆ HeapTupleHeaderGetRawXmax()

◆ HeapTupleHeaderGetRawXmin()

◆ HeapTupleHeaderGetSpeculativeToken()

static BlockNumber HeapTupleHeaderGetSpeculativeToken ( const HeapTupleHeaderData tup)
inlinestatic

Definition at line 467 of file htup_details.h.

467{
469}
470
471static inline BlockNumber
uint32 BlockNumber
Definition: block.h:31
static OffsetNumber ItemPointerGetOffsetNumberNoCheck(const ItemPointerData *pointer)
Definition: itemptr.h:114
#define SpecTokenOffsetNumber
Definition: itemptr.h:63

References ItemPointerGetOffsetNumberNoCheck(), SpecTokenOffsetNumber, and HeapTupleHeaderData::t_ctid.

Referenced by HeapTupleSatisfiesDirty().

◆ HeapTupleHeaderGetTypeId()

◆ HeapTupleHeaderGetTypMod()

◆ HeapTupleHeaderGetUpdateXid()

◆ HeapTupleHeaderGetXmin()

◆ HeapTupleHeaderGetXvac()

◆ HeapTupleHeaderHasMatch()

static bool HeapTupleHeaderHasMatch ( const MinimalTupleData tup)
inlinestatic

◆ HeapTupleHeaderIndicatesMovedPartitions()

static bool HeapTupleHeaderIndicatesMovedPartitions ( const HeapTupleHeaderData tup)
inlinestatic

Definition at line 480 of file htup_details.h.

480{
482}
483
#define token
Definition: indent_globs.h:126
static void ItemPointerSet(ItemPointerData *pointer, BlockNumber blockNumber, OffsetNumber offNum)
Definition: itemptr.h:135

References ItemPointerSet(), SpecTokenOffsetNumber, HeapTupleHeaderData::t_ctid, and token.

Referenced by heap_get_latest_tid(), heap_get_root_tuples(), heap_lock_updated_tuple(), heap_lock_updated_tuple_rec(), heap_prune_chain(), and rewrite_heap_tuple().

◆ HeapTupleHeaderIsHeapOnly()

static bool HeapTupleHeaderIsHeapOnly ( const HeapTupleHeaderData tup)
inlinestatic

◆ HeapTupleHeaderIsHotUpdated()

static bool HeapTupleHeaderIsHotUpdated ( const HeapTupleHeaderData tup)
inlinestatic

◆ HeapTupleHeaderIsSpeculative()

static bool HeapTupleHeaderIsSpeculative ( const HeapTupleHeaderData tup)
inlinestatic

◆ HeapTupleHeaderSetCmax()

static void HeapTupleHeaderSetCmax ( HeapTupleHeaderData tup,
CommandId  cid,
bool  iscombo 
)
inlinestatic

Definition at line 431 of file htup_details.h.

437{
438 Assert(!((tup)->t_infomask & HEAP_MOVED));
439 tup->t_choice.t_heap.t_field3.t_cid = cid;
#define HEAP_MOVED
Definition: htup_details.h:213
union HeapTupleFields::@46 t_field3
CommandId t_cid
Definition: htup_details.h:129

Referenced by heap_delete(), heap_update(), heap_xlog_delete(), heap_xlog_lock(), and heap_xlog_update().

◆ HeapTupleHeaderSetCmin()

◆ HeapTupleHeaderSetDatumLength()

static void HeapTupleHeaderSetDatumLength ( HeapTupleHeaderData tup,
uint32  len 
)
inlinestatic

Definition at line 498 of file htup_details.h.

498{
499 return VARSIZE(tup);
500}
501
#define VARSIZE(PTR)
Definition: varatt.h:279

References VARSIZE.

Referenced by ER_flatten_into(), expand_tuple(), heap_copy_tuple_as_datum(), heap_form_tuple(), and toast_flatten_tuple_to_datum().

◆ HeapTupleHeaderSetHeapOnly()

static void HeapTupleHeaderSetHeapOnly ( HeapTupleHeaderData tup)
inlinestatic

Definition at line 561 of file htup_details.h.

561{
562 return (tup->t_infomask2 & HEAP_ONLY_TUPLE) != 0;
563}
564

References HEAP_ONLY_TUPLE, and HeapTupleHeaderData::t_infomask2.

Referenced by HeapTupleClearHeapOnly().

◆ HeapTupleHeaderSetHotUpdated()

static void HeapTupleHeaderSetHotUpdated ( HeapTupleHeaderData tup)
inlinestatic

Definition at line 543 of file htup_details.h.

549{

Referenced by heap_xlog_update(), and HeapTupleClearHotUpdated().

◆ HeapTupleHeaderSetMatch()

static void HeapTupleHeaderSetMatch ( MinimalTupleData tup)
inlinestatic

Definition at line 712 of file htup_details.h.

712{
713 return (tup->t_infomask2 & HEAP_TUPLE_HAS_MATCH) != 0;
714}
715

References HEAP_TUPLE_HAS_MATCH, and MinimalTupleData::t_infomask2.

Referenced by ExecHashJoinImpl().

◆ HeapTupleHeaderSetMovedPartitions()

static void HeapTupleHeaderSetMovedPartitions ( HeapTupleHeaderData tup)
inlinestatic

Definition at line 486 of file htup_details.h.

486{
488}
489
static bool ItemPointerIndicatesMovedPartitions(const ItemPointerData *pointer)
Definition: itemptr.h:197

References ItemPointerIndicatesMovedPartitions(), and HeapTupleHeaderData::t_ctid.

Referenced by heap_delete(), and heap_xlog_delete().

◆ HeapTupleHeaderSetSpeculativeToken()

static void HeapTupleHeaderSetSpeculativeToken ( HeapTupleHeaderData tup,
BlockNumber  token 
)
inlinestatic

Definition at line 474 of file htup_details.h.

480{

Referenced by heapam_tuple_insert_speculative().

◆ HeapTupleHeaderSetTypeId()

◆ HeapTupleHeaderSetTypMod()

◆ HeapTupleHeaderSetXmax()

◆ HeapTupleHeaderSetXmin()

◆ HeapTupleHeaderSetXminCommitted()

static void HeapTupleHeaderSetXminCommitted ( HeapTupleHeaderData tup)
inlinestatic

Definition at line 356 of file htup_details.h.

356{
358}
359
360static inline void
#define HEAP_XMIN_FROZEN
Definition: htup_details.h:206

References HEAP_XMIN_FROZEN, and HeapTupleHeaderData::t_infomask.

◆ HeapTupleHeaderSetXminFrozen()

static void HeapTupleHeaderSetXminFrozen ( HeapTupleHeaderData tup)
inlinestatic

Definition at line 370 of file htup_details.h.

376{

Referenced by fill_seq_fork_with_data(), and heap_prepare_insert().

◆ HeapTupleHeaderSetXminInvalid()

static void HeapTupleHeaderSetXminInvalid ( HeapTupleHeaderData tup)
inlinestatic

Definition at line 363 of file htup_details.h.

369{

◆ HeapTupleHeaderSetXvac()

static void HeapTupleHeaderSetXvac ( HeapTupleHeaderData tup,
TransactionId  xid 
)
inlinestatic

Definition at line 451 of file htup_details.h.

457{

Referenced by heap_execute_freeze_tuple(), and heap_force_common().

◆ HeapTupleHeaderXminCommitted()

◆ HeapTupleHeaderXminFrozen()

static bool HeapTupleHeaderXminFrozen ( const HeapTupleHeaderData tup)
inlinestatic

Definition at line 350 of file htup_details.h.

356{

Referenced by heap_mask(), heap_pre_freeze_checks(), and HeapTupleSatisfiesMVCC().

◆ HeapTupleHeaderXminInvalid()

◆ HeapTupleIsHeapOnly()

static bool HeapTupleIsHeapOnly ( const HeapTupleData tuple)
inlinestatic

◆ HeapTupleIsHotUpdated()

static bool HeapTupleIsHotUpdated ( const HeapTupleData tuple)
inlinestatic

Definition at line 768 of file htup_details.h.

768{
769 return (tuple->t_data->t_infomask & HEAP_HASEXTERNAL) != 0;
770}
771

References HEAP_HASEXTERNAL, HeapTupleData::t_data, and HeapTupleHeaderData::t_infomask.

Referenced by heap_hot_search_buffer(), and heapam_index_build_range_scan().

◆ HeapTupleNoNulls()

static bool HeapTupleNoNulls ( const HeapTupleData tuple)
inlinestatic

Definition at line 744 of file htup_details.h.

744{
745 return (tuple->t_data->t_infomask & HEAP_HASNULL) != 0;
746}
747

References HEAP_HASNULL, HeapTupleData::t_data, and HeapTupleHeaderData::t_infomask.

Referenced by fastgetattr(), heap_attisnull(), and nocachegetattr().

◆ HeapTupleSetHeapOnly()

static void HeapTupleSetHeapOnly ( const HeapTupleData tuple)
inlinestatic

Definition at line 792 of file htup_details.h.

792{
793 return HeapTupleHeaderIsHeapOnly(tuple->t_data);
794}
795
static bool HeapTupleHeaderIsHeapOnly(const HeapTupleHeaderData *tup)
Definition: htup_details.h:555

References HeapTupleHeaderIsHeapOnly(), and HeapTupleData::t_data.

Referenced by heap_update().

◆ HeapTupleSetHotUpdated()

static void HeapTupleSetHotUpdated ( const HeapTupleData tuple)
inlinestatic

Definition at line 774 of file htup_details.h.

774{
775 return HeapTupleHeaderIsHotUpdated(tuple->t_data);
776}
777
static bool HeapTupleHeaderIsHotUpdated(const HeapTupleHeaderData *tup)
Definition: htup_details.h:534

References HeapTupleHeaderIsHotUpdated(), and HeapTupleData::t_data.

Referenced by heap_update().

◆ minimal_expand_tuple()

MinimalTuple minimal_expand_tuple ( HeapTuple  sourceTuple,
TupleDesc  tupleDesc 
)

Definition at line 1054 of file heaptuple.c.

1055{
1056 MinimalTuple minimalTuple;
1057
1058 expand_tuple(NULL, &minimalTuple, sourceTuple, tupleDesc);
1059 return minimalTuple;
1060}

References expand_tuple().

◆ minimal_tuple_from_heap_tuple()

MinimalTuple minimal_tuple_from_heap_tuple ( HeapTuple  htup)

Definition at line 1577 of file heaptuple.c.

1578{
1579 MinimalTuple result;
1580 uint32 len;
1581
1583 len = htup->t_len - MINIMAL_TUPLE_OFFSET;
1584 result = (MinimalTuple) palloc(len);
1585 memcpy(result, (char *) htup->t_data + MINIMAL_TUPLE_OFFSET, len);
1586 result->t_len = len;
1587 return result;
1588}

References Assert, len, MINIMAL_TUPLE_OFFSET, palloc(), HeapTupleData::t_data, HeapTupleData::t_len, and MinimalTupleData::t_len.

Referenced by copytup_heap(), tts_buffer_heap_copy_minimal_tuple(), and tts_heap_copy_minimal_tuple().

◆ nocachegetattr()

Datum nocachegetattr ( HeapTuple  tup,
int  attnum,
TupleDesc  tupleDesc 
)

Definition at line 521 of file heaptuple.c.

524{
525 HeapTupleHeader td = tup->t_data;
526 char *tp; /* ptr to data part of tuple */
527 bits8 *bp = td->t_bits; /* ptr to null bitmap in tuple */
528 bool slow = false; /* do we have to walk attrs? */
529 int off; /* current offset within data */
530
531 /* ----------------
532 * Three cases:
533 *
534 * 1: No nulls and no variable-width attributes.
535 * 2: Has a null or a var-width AFTER att.
536 * 3: Has nulls or var-widths BEFORE att.
537 * ----------------
538 */
539
540 attnum--;
541
542 if (!HeapTupleNoNulls(tup))
543 {
544 /*
545 * there's a null somewhere in the tuple
546 *
547 * check to see if any preceding bits are null...
548 */
549 int byte = attnum >> 3;
550 int finalbit = attnum & 0x07;
551
552 /* check for nulls "before" final bit of last byte */
553 if ((~bp[byte]) & ((1 << finalbit) - 1))
554 slow = true;
555 else
556 {
557 /* check for nulls in any "earlier" bytes */
558 int i;
559
560 for (i = 0; i < byte; i++)
561 {
562 if (bp[i] != 0xFF)
563 {
564 slow = true;
565 break;
566 }
567 }
568 }
569 }
570
571 tp = (char *) td + td->t_hoff;
572
573 if (!slow)
574 {
575 CompactAttribute *att;
576
577 /*
578 * If we get here, there are no nulls up to and including the target
579 * attribute. If we have a cached offset, we can use it.
580 */
581 att = TupleDescCompactAttr(tupleDesc, attnum);
582 if (att->attcacheoff >= 0)
583 return fetchatt(att, tp + att->attcacheoff);
584
585 /*
586 * Otherwise, check for non-fixed-length attrs up to and including
587 * target. If there aren't any, it's safe to cheaply initialize the
588 * cached offsets for these attrs.
589 */
590 if (HeapTupleHasVarWidth(tup))
591 {
592 int j;
593
594 for (j = 0; j <= attnum; j++)
595 {
596 if (TupleDescCompactAttr(tupleDesc, j)->attlen <= 0)
597 {
598 slow = true;
599 break;
600 }
601 }
602 }
603 }
604
605 if (!slow)
606 {
607 int natts = tupleDesc->natts;
608 int j = 1;
609
610 /*
611 * If we get here, we have a tuple with no nulls or var-widths up to
612 * and including the target attribute, so we can use the cached offset
613 * ... only we don't have it yet, or we'd not have got here. Since
614 * it's cheap to compute offsets for fixed-width columns, we take the
615 * opportunity to initialize the cached offsets for *all* the leading
616 * fixed-width columns, in hope of avoiding future visits to this
617 * routine.
618 */
619 TupleDescCompactAttr(tupleDesc, 0)->attcacheoff = 0;
620
621 /* we might have set some offsets in the slow path previously */
622 while (j < natts && TupleDescCompactAttr(tupleDesc, j)->attcacheoff > 0)
623 j++;
624
625 off = TupleDescCompactAttr(tupleDesc, j - 1)->attcacheoff +
626 TupleDescCompactAttr(tupleDesc, j - 1)->attlen;
627
628 for (; j < natts; j++)
629 {
630 CompactAttribute *att = TupleDescCompactAttr(tupleDesc, j);
631
632 if (att->attlen <= 0)
633 break;
634
635 off = att_nominal_alignby(off, att->attalignby);
636
637 att->attcacheoff = off;
638
639 off += att->attlen;
640 }
641
642 Assert(j > attnum);
643
644 off = TupleDescCompactAttr(tupleDesc, attnum)->attcacheoff;
645 }
646 else
647 {
648 bool usecache = true;
649 int i;
650
651 /*
652 * Now we know that we have to walk the tuple CAREFULLY. But we still
653 * might be able to cache some offsets for next time.
654 *
655 * Note - This loop is a little tricky. For each non-null attribute,
656 * we have to first account for alignment padding before the attr,
657 * then advance over the attr based on its length. Nulls have no
658 * storage and no alignment padding either. We can use/set
659 * attcacheoff until we reach either a null or a var-width attribute.
660 */
661 off = 0;
662 for (i = 0;; i++) /* loop exit is at "break" */
663 {
664 CompactAttribute *att = TupleDescCompactAttr(tupleDesc, i);
665
666 if (HeapTupleHasNulls(tup) && att_isnull(i, bp))
667 {
668 usecache = false;
669 continue; /* this cannot be the target att */
670 }
671
672 /* If we know the next offset, we can skip the rest */
673 if (usecache && att->attcacheoff >= 0)
674 off = att->attcacheoff;
675 else if (att->attlen == -1)
676 {
677 /*
678 * We can only cache the offset for a varlena attribute if the
679 * offset is already suitably aligned, so that there would be
680 * no pad bytes in any case: then the offset will be valid for
681 * either an aligned or unaligned value.
682 */
683 if (usecache &&
684 off == att_nominal_alignby(off, att->attalignby))
685 att->attcacheoff = off;
686 else
687 {
688 off = att_pointer_alignby(off, att->attalignby, -1,
689 tp + off);
690 usecache = false;
691 }
692 }
693 else
694 {
695 /* not varlena, so safe to use att_nominal_alignby */
696 off = att_nominal_alignby(off, att->attalignby);
697
698 if (usecache)
699 att->attcacheoff = off;
700 }
701
702 if (i == attnum)
703 break;
704
705 off = att_addlength_pointer(off, att->attlen, tp + off);
706
707 if (usecache && att->attlen <= 0)
708 usecache = false;
709 }
710 }
711
712 return fetchatt(TupleDescCompactAttr(tupleDesc, attnum), tp + off);
713}
int j
Definition: isn.c:73
if(TABLE==NULL||TABLE_index==NULL)
Definition: isn.c:76
int16 attlen
Definition: pg_attribute.h:59

References Assert, att_addlength_pointer, att_isnull(), att_nominal_alignby, att_pointer_alignby, CompactAttribute::attalignby, CompactAttribute::attcacheoff, CompactAttribute::attlen, attlen, attnum, fetchatt, HeapTupleHasNulls(), HeapTupleHasVarWidth(), HeapTupleNoNulls(), i, if(), j, TupleDescData::natts, HeapTupleHeaderData::t_bits, HeapTupleData::t_data, HeapTupleHeaderData::t_hoff, and TupleDescCompactAttr().

Referenced by fastgetattr().

◆ StaticAssertDecl()

◆ varsize_any()

size_t varsize_any ( void *  p)

Definition at line 1595 of file heaptuple.c.

1596{
1597 return VARSIZE_ANY(p);
1598}

References VARSIZE_ANY.