PostgreSQL Source Code  git master
tableam.h File Reference
#include "access/relscan.h"
#include "access/sdir.h"
#include "access/xact.h"
#include "utils/guc.h"
#include "utils/rel.h"
#include "utils/snapshot.h"
Include dependency graph for tableam.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  TM_FailureData
 
struct  TM_IndexDelete
 
struct  TM_IndexStatus
 
struct  TM_IndexDeleteOp
 
struct  TableAmRoutine
 

Macros

#define DEFAULT_TABLE_ACCESS_METHOD   "heap"
 
#define TABLE_INSERT_SKIP_FSM   0x0002
 
#define TABLE_INSERT_FROZEN   0x0004
 
#define TABLE_INSERT_NO_LOGICAL   0x0008
 
#define TUPLE_LOCK_FLAG_LOCK_UPDATE_IN_PROGRESS   (1 << 0)
 
#define TUPLE_LOCK_FLAG_FIND_LAST_VERSION   (1 << 1)
 

Typedefs

typedef enum ScanOptions ScanOptions
 
typedef enum TM_Result TM_Result
 
typedef struct TM_FailureData TM_FailureData
 
typedef struct TM_IndexDelete TM_IndexDelete
 
typedef struct TM_IndexStatus TM_IndexStatus
 
typedef struct TM_IndexDeleteOp TM_IndexDeleteOp
 
typedef void(* IndexBuildCallback) (Relation index, ItemPointer tid, Datum *values, bool *isnull, bool tupleIsAlive, void *state)
 
typedef struct TableAmRoutine TableAmRoutine
 

Enumerations

enum  ScanOptions {
  SO_TYPE_SEQSCAN = 1 << 0 , SO_TYPE_BITMAPSCAN = 1 << 1 , SO_TYPE_SAMPLESCAN = 1 << 2 , SO_TYPE_TIDSCAN = 1 << 3 ,
  SO_TYPE_TIDRANGESCAN = 1 << 4 , SO_TYPE_ANALYZE = 1 << 5 , SO_ALLOW_STRAT = 1 << 6 , SO_ALLOW_SYNC = 1 << 7 ,
  SO_ALLOW_PAGEMODE = 1 << 8 , SO_TEMP_SNAPSHOT = 1 << 9
}
 
enum  TM_Result {
  TM_Ok , TM_Invisible , TM_SelfModified , TM_Updated ,
  TM_Deleted , TM_BeingModified , TM_WouldBlock
}
 

Functions

const TupleTableSlotOpstable_slot_callbacks (Relation rel)
 
TupleTableSlottable_slot_create (Relation rel, List **reglist)
 
static TableScanDesc table_beginscan (Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key)
 
TableScanDesc table_beginscan_catalog (Relation rel, int nkeys, struct ScanKeyData *key)
 
static TableScanDesc table_beginscan_strat (Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key, bool allow_strat, bool allow_sync)
 
static TableScanDesc table_beginscan_bm (Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key)
 
static TableScanDesc table_beginscan_sampling (Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key, bool allow_strat, bool allow_sync, bool allow_pagemode)
 
static TableScanDesc table_beginscan_tid (Relation rel, Snapshot snapshot)
 
static TableScanDesc table_beginscan_analyze (Relation rel)
 
static void table_endscan (TableScanDesc scan)
 
static void table_rescan (TableScanDesc scan, struct ScanKeyData *key)
 
static void table_rescan_set_params (TableScanDesc scan, struct ScanKeyData *key, bool allow_strat, bool allow_sync, bool allow_pagemode)
 
void table_scan_update_snapshot (TableScanDesc scan, Snapshot snapshot)
 
static bool table_scan_getnextslot (TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
 
static TableScanDesc table_beginscan_tidrange (Relation rel, Snapshot snapshot, ItemPointer mintid, ItemPointer maxtid)
 
static void table_rescan_tidrange (TableScanDesc sscan, ItemPointer mintid, ItemPointer maxtid)
 
static bool table_scan_getnextslot_tidrange (TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
 
Size table_parallelscan_estimate (Relation rel, Snapshot snapshot)
 
void table_parallelscan_initialize (Relation rel, ParallelTableScanDesc pscan, Snapshot snapshot)
 
TableScanDesc table_beginscan_parallel (Relation rel, ParallelTableScanDesc pscan)
 
static void table_parallelscan_reinitialize (Relation rel, ParallelTableScanDesc pscan)
 
static IndexFetchTableDatatable_index_fetch_begin (Relation rel)
 
static void table_index_fetch_reset (struct IndexFetchTableData *scan)
 
static void table_index_fetch_end (struct IndexFetchTableData *scan)
 
static bool table_index_fetch_tuple (struct IndexFetchTableData *scan, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, bool *call_again, bool *all_dead)
 
bool table_index_fetch_tuple_check (Relation rel, ItemPointer tid, Snapshot snapshot, bool *all_dead)
 
static bool table_tuple_fetch_row_version (Relation rel, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot)
 
static bool table_tuple_tid_valid (TableScanDesc scan, ItemPointer tid)
 
void table_tuple_get_latest_tid (TableScanDesc scan, ItemPointer tid)
 
static bool table_tuple_satisfies_snapshot (Relation rel, TupleTableSlot *slot, Snapshot snapshot)
 
static TransactionId table_index_delete_tuples (Relation rel, TM_IndexDeleteOp *delstate)
 
static void table_tuple_insert (Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate)
 
static void table_tuple_insert_speculative (Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate, uint32 specToken)
 
static void table_tuple_complete_speculative (Relation rel, TupleTableSlot *slot, uint32 specToken, bool succeeded)
 
static void table_multi_insert (Relation rel, TupleTableSlot **slots, int nslots, CommandId cid, int options, struct BulkInsertStateData *bistate)
 
static TM_Result table_tuple_delete (Relation rel, ItemPointer tid, CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, bool changingPart)
 
static TM_Result table_tuple_update (Relation rel, ItemPointer otid, TupleTableSlot *slot, CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, LockTupleMode *lockmode, bool *update_indexes)
 
static TM_Result table_tuple_lock (Relation rel, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, CommandId cid, LockTupleMode mode, LockWaitPolicy wait_policy, uint8 flags, TM_FailureData *tmfd)
 
static void table_finish_bulk_insert (Relation rel, int options)
 
static void table_relation_set_new_filenode (Relation rel, const RelFileNode *newrnode, char persistence, TransactionId *freezeXid, MultiXactId *minmulti)
 
static void table_relation_nontransactional_truncate (Relation rel)
 
static void table_relation_copy_data (Relation rel, const RelFileNode *newrnode)
 
static void table_relation_copy_for_cluster (Relation OldTable, Relation NewTable, Relation OldIndex, bool use_sort, TransactionId OldestXmin, TransactionId *xid_cutoff, MultiXactId *multi_cutoff, double *num_tuples, double *tups_vacuumed, double *tups_recently_dead)
 
static void table_relation_vacuum (Relation rel, struct VacuumParams *params, BufferAccessStrategy bstrategy)
 
static bool table_scan_analyze_next_block (TableScanDesc scan, BlockNumber blockno, BufferAccessStrategy bstrategy)
 
static bool table_scan_analyze_next_tuple (TableScanDesc scan, TransactionId OldestXmin, double *liverows, double *deadrows, TupleTableSlot *slot)
 
static double table_index_build_scan (Relation table_rel, Relation index_rel, struct IndexInfo *index_info, bool allow_sync, bool progress, IndexBuildCallback callback, void *callback_state, TableScanDesc scan)
 
static double table_index_build_range_scan (Relation table_rel, Relation index_rel, struct IndexInfo *index_info, bool allow_sync, bool anyvisible, bool progress, BlockNumber start_blockno, BlockNumber numblocks, IndexBuildCallback callback, void *callback_state, TableScanDesc scan)
 
static void table_index_validate_scan (Relation table_rel, Relation index_rel, struct IndexInfo *index_info, Snapshot snapshot, struct ValidateIndexState *state)
 
static uint64 table_relation_size (Relation rel, ForkNumber forkNumber)
 
static bool table_relation_needs_toast_table (Relation rel)
 
static Oid table_relation_toast_am (Relation rel)
 
static void table_relation_fetch_toast_slice (Relation toastrel, Oid valueid, int32 attrsize, int32 sliceoffset, int32 slicelength, struct varlena *result)
 
static void table_relation_estimate_size (Relation rel, int32 *attr_widths, BlockNumber *pages, double *tuples, double *allvisfrac)
 
static bool table_scan_bitmap_next_block (TableScanDesc scan, struct TBMIterateResult *tbmres)
 
static bool table_scan_bitmap_next_tuple (TableScanDesc scan, struct TBMIterateResult *tbmres, TupleTableSlot *slot)
 
static bool table_scan_sample_next_block (TableScanDesc scan, struct SampleScanState *scanstate)
 
static bool table_scan_sample_next_tuple (TableScanDesc scan, struct SampleScanState *scanstate, TupleTableSlot *slot)
 
void simple_table_tuple_insert (Relation rel, TupleTableSlot *slot)
 
void simple_table_tuple_delete (Relation rel, ItemPointer tid, Snapshot snapshot)
 
void simple_table_tuple_update (Relation rel, ItemPointer otid, TupleTableSlot *slot, Snapshot snapshot, bool *update_indexes)
 
Size table_block_parallelscan_estimate (Relation rel)
 
Size table_block_parallelscan_initialize (Relation rel, ParallelTableScanDesc pscan)
 
void table_block_parallelscan_reinitialize (Relation rel, ParallelTableScanDesc pscan)
 
BlockNumber table_block_parallelscan_nextpage (Relation rel, ParallelBlockTableScanWorker pbscanwork, ParallelBlockTableScanDesc pbscan)
 
void table_block_parallelscan_startblock_init (Relation rel, ParallelBlockTableScanWorker pbscanwork, ParallelBlockTableScanDesc pbscan)
 
uint64 table_block_relation_size (Relation rel, ForkNumber forkNumber)
 
void table_block_relation_estimate_size (Relation rel, int32 *attr_widths, BlockNumber *pages, double *tuples, double *allvisfrac, Size overhead_bytes_per_tuple, Size usable_bytes_per_page)
 
const TableAmRoutineGetTableAmRoutine (Oid amhandler)
 
const TableAmRoutineGetHeapamTableAmRoutine (void)
 
bool check_default_table_access_method (char **newval, void **extra, GucSource source)
 

Variables

PGDLLIMPORT char * default_table_access_method
 
PGDLLIMPORT bool synchronize_seqscans
 

Macro Definition Documentation

◆ DEFAULT_TABLE_ACCESS_METHOD

#define DEFAULT_TABLE_ACCESS_METHOD   "heap"

Definition at line 28 of file tableam.h.

◆ TABLE_INSERT_FROZEN

#define TABLE_INSERT_FROZEN   0x0004

Definition at line 237 of file tableam.h.

◆ TABLE_INSERT_NO_LOGICAL

#define TABLE_INSERT_NO_LOGICAL   0x0008

Definition at line 238 of file tableam.h.

◆ TABLE_INSERT_SKIP_FSM

#define TABLE_INSERT_SKIP_FSM   0x0002

Definition at line 236 of file tableam.h.

◆ TUPLE_LOCK_FLAG_FIND_LAST_VERSION

#define TUPLE_LOCK_FLAG_FIND_LAST_VERSION   (1 << 1)

Definition at line 244 of file tableam.h.

◆ TUPLE_LOCK_FLAG_LOCK_UPDATE_IN_PROGRESS

#define TUPLE_LOCK_FLAG_LOCK_UPDATE_IN_PROGRESS   (1 << 0)

Definition at line 242 of file tableam.h.

Typedef Documentation

◆ IndexBuildCallback

typedef void(* IndexBuildCallback) (Relation index, ItemPointer tid, Datum *values, bool *isnull, bool tupleIsAlive, void *state)

Definition at line 248 of file tableam.h.

◆ ScanOptions

typedef enum ScanOptions ScanOptions

◆ TableAmRoutine

◆ TM_FailureData

◆ TM_IndexDelete

◆ TM_IndexDeleteOp

◆ TM_IndexStatus

◆ TM_Result

typedef enum TM_Result TM_Result

Enumeration Type Documentation

◆ ScanOptions

Enumerator
SO_TYPE_SEQSCAN 
SO_TYPE_BITMAPSCAN 
SO_TYPE_SAMPLESCAN 
SO_TYPE_TIDSCAN 
SO_TYPE_TIDRANGESCAN 
SO_TYPE_ANALYZE 
SO_ALLOW_STRAT 
SO_ALLOW_SYNC 
SO_ALLOW_PAGEMODE 
SO_TEMP_SNAPSHOT 

Definition at line 45 of file tableam.h.

46 {
47  /* one of SO_TYPE_* may be specified */
48  SO_TYPE_SEQSCAN = 1 << 0,
49  SO_TYPE_BITMAPSCAN = 1 << 1,
50  SO_TYPE_SAMPLESCAN = 1 << 2,
51  SO_TYPE_TIDSCAN = 1 << 3,
52  SO_TYPE_TIDRANGESCAN = 1 << 4,
53  SO_TYPE_ANALYZE = 1 << 5,
54 
55  /* several of SO_ALLOW_* may be specified */
56  /* allow or disallow use of access strategy */
57  SO_ALLOW_STRAT = 1 << 6,
58  /* report location to syncscan logic? */
59  SO_ALLOW_SYNC = 1 << 7,
60  /* verify visibility page-at-a-time? */
61  SO_ALLOW_PAGEMODE = 1 << 8,
62 
63  /* unregister snapshot at scan end? */
64  SO_TEMP_SNAPSHOT = 1 << 9
65 } ScanOptions;
ScanOptions
Definition: tableam.h:46
@ SO_ALLOW_STRAT
Definition: tableam.h:57
@ SO_TYPE_TIDRANGESCAN
Definition: tableam.h:52
@ SO_TYPE_ANALYZE
Definition: tableam.h:53
@ SO_TEMP_SNAPSHOT
Definition: tableam.h:64
@ SO_TYPE_TIDSCAN
Definition: tableam.h:51
@ SO_ALLOW_PAGEMODE
Definition: tableam.h:61
@ SO_TYPE_SAMPLESCAN
Definition: tableam.h:50
@ SO_ALLOW_SYNC
Definition: tableam.h:59
@ SO_TYPE_SEQSCAN
Definition: tableam.h:48
@ SO_TYPE_BITMAPSCAN
Definition: tableam.h:49

◆ TM_Result

enum TM_Result
Enumerator
TM_Ok 
TM_Invisible 
TM_SelfModified 
TM_Updated 
TM_Deleted 
TM_BeingModified 
TM_WouldBlock 

Definition at line 71 of file tableam.h.

72 {
73  /*
74  * Signals that the action succeeded (i.e. update/delete performed, lock
75  * was acquired)
76  */
77  TM_Ok,
78 
79  /* The affected tuple wasn't visible to the relevant snapshot */
81 
82  /* The affected tuple was already modified by the calling backend */
84 
85  /*
86  * The affected tuple was updated by another transaction. This includes
87  * the case where tuple was moved to another partition.
88  */
89  TM_Updated,
90 
91  /* The affected tuple was deleted by another transaction */
92  TM_Deleted,
93 
94  /*
95  * The affected tuple is currently being modified by another session. This
96  * will only be returned if table_(update/delete/lock_tuple) are
97  * instructed not to wait.
98  */
100 
101  /* lock couldn't be acquired, action skipped. Only used by lock_tuple */
103 } TM_Result;
TM_Result
Definition: tableam.h:72
@ TM_Ok
Definition: tableam.h:77
@ TM_BeingModified
Definition: tableam.h:99
@ TM_Deleted
Definition: tableam.h:92
@ TM_WouldBlock
Definition: tableam.h:102
@ TM_Updated
Definition: tableam.h:89
@ TM_SelfModified
Definition: tableam.h:83
@ TM_Invisible
Definition: tableam.h:80

Function Documentation

◆ check_default_table_access_method()

bool check_default_table_access_method ( char **  newval,
void **  extra,
GucSource  source 
)

Definition at line 111 of file tableamapi.c.

112 {
113  if (**newval == '\0')
114  {
115  GUC_check_errdetail("%s cannot be empty.",
116  "default_table_access_method");
117  return false;
118  }
119 
120  if (strlen(*newval) >= NAMEDATALEN)
121  {
122  GUC_check_errdetail("%s is too long (maximum %d characters).",
123  "default_table_access_method", NAMEDATALEN - 1);
124  return false;
125  }
126 
127  /*
128  * If we aren't inside a transaction, or not connected to a database, we
129  * cannot do the catalog access necessary to verify the method. Must
130  * accept the value on faith.
131  */
133  {
134  if (!OidIsValid(get_table_am_oid(*newval, true)))
135  {
136  /*
137  * When source == PGC_S_TEST, don't throw a hard error for a
138  * nonexistent table access method, only a NOTICE. See comments in
139  * guc.h.
140  */
141  if (source == PGC_S_TEST)
142  {
143  ereport(NOTICE,
144  (errcode(ERRCODE_UNDEFINED_OBJECT),
145  errmsg("table access method \"%s\" does not exist",
146  *newval)));
147  }
148  else
149  {
150  GUC_check_errdetail("Table access method \"%s\" does not exist.",
151  *newval);
152  return false;
153  }
154  }
155  }
156 
157  return true;
158 }
Oid get_table_am_oid(const char *amname, bool missing_ok)
Definition: amcmds.c:173
#define OidIsValid(objectId)
Definition: c.h:710
int errcode(int sqlerrcode)
Definition: elog.c:693
int errmsg(const char *fmt,...)
Definition: elog.c:904
#define NOTICE
Definition: elog.h:29
#define ereport(elevel,...)
Definition: elog.h:143
Oid MyDatabaseId
Definition: globals.c:89
#define newval
#define GUC_check_errdetail
Definition: guc.h:427
@ PGC_S_TEST
Definition: guc.h:118
#define NAMEDATALEN
static rewind_source * source
Definition: pg_rewind.c:81
#define InvalidOid
Definition: postgres_ext.h:36
bool IsTransactionState(void)
Definition: xact.c:374

References ereport, errcode(), errmsg(), get_table_am_oid(), GUC_check_errdetail, InvalidOid, IsTransactionState(), MyDatabaseId, NAMEDATALEN, newval, NOTICE, OidIsValid, PGC_S_TEST, and source.

◆ GetHeapamTableAmRoutine()

const TableAmRoutine* GetHeapamTableAmRoutine ( void  )

Definition at line 2597 of file heapam_handler.c.

2598 {
2599  return &heapam_methods;
2600 }
static const TableAmRoutine heapam_methods

References heapam_methods.

Referenced by formrdesc(), and heap_getnext().

◆ GetTableAmRoutine()

const TableAmRoutine* GetTableAmRoutine ( Oid  amhandler)

Definition at line 34 of file tableamapi.c.

35 {
36  Datum datum;
37  const TableAmRoutine *routine;
38 
39  datum = OidFunctionCall0(amhandler);
40  routine = (TableAmRoutine *) DatumGetPointer(datum);
41 
42  if (routine == NULL || !IsA(routine, TableAmRoutine))
43  elog(ERROR, "table access method handler %u did not return a TableAmRoutine struct",
44  amhandler);
45 
46  /*
47  * Assert that all required callbacks are present. That makes it a bit
48  * easier to keep AMs up to date, e.g. when forward porting them to a new
49  * major version.
50  */
51  Assert(routine->scan_begin != NULL);
52  Assert(routine->scan_end != NULL);
53  Assert(routine->scan_rescan != NULL);
54  Assert(routine->scan_getnextslot != NULL);
55 
56  Assert(routine->parallelscan_estimate != NULL);
57  Assert(routine->parallelscan_initialize != NULL);
58  Assert(routine->parallelscan_reinitialize != NULL);
59 
60  Assert(routine->index_fetch_begin != NULL);
61  Assert(routine->index_fetch_reset != NULL);
62  Assert(routine->index_fetch_end != NULL);
63  Assert(routine->index_fetch_tuple != NULL);
64 
65  Assert(routine->tuple_fetch_row_version != NULL);
66  Assert(routine->tuple_tid_valid != NULL);
67  Assert(routine->tuple_get_latest_tid != NULL);
68  Assert(routine->tuple_satisfies_snapshot != NULL);
69  Assert(routine->index_delete_tuples != NULL);
70 
71  Assert(routine->tuple_insert != NULL);
72 
73  /*
74  * Could be made optional, but would require throwing error during
75  * parse-analysis.
76  */
77  Assert(routine->tuple_insert_speculative != NULL);
78  Assert(routine->tuple_complete_speculative != NULL);
79 
80  Assert(routine->multi_insert != NULL);
81  Assert(routine->tuple_delete != NULL);
82  Assert(routine->tuple_update != NULL);
83  Assert(routine->tuple_lock != NULL);
84 
85  Assert(routine->relation_set_new_filenode != NULL);
87  Assert(routine->relation_copy_data != NULL);
88  Assert(routine->relation_copy_for_cluster != NULL);
89  Assert(routine->relation_vacuum != NULL);
90  Assert(routine->scan_analyze_next_block != NULL);
91  Assert(routine->scan_analyze_next_tuple != NULL);
92  Assert(routine->index_build_range_scan != NULL);
93  Assert(routine->index_validate_scan != NULL);
94 
95  Assert(routine->relation_size != NULL);
96  Assert(routine->relation_needs_toast_table != NULL);
97 
98  Assert(routine->relation_estimate_size != NULL);
99 
100  /* optional, but one callback implies presence of the other */
101  Assert((routine->scan_bitmap_next_block == NULL) ==
102  (routine->scan_bitmap_next_tuple == NULL));
103  Assert(routine->scan_sample_next_block != NULL);
104  Assert(routine->scan_sample_next_tuple != NULL);
105 
106  return routine;
107 }
#define ERROR
Definition: elog.h:33
#define elog(elevel,...)
Definition: elog.h:218
#define OidFunctionCall0(functionId)
Definition: fmgr.h:667
Assert(fmt[strlen(fmt) - 1] !='\n')
#define IsA(nodeptr, _type_)
Definition: nodes.h:624
uintptr_t Datum
Definition: postgres.h:411
#define DatumGetPointer(X)
Definition: postgres.h:593
Size(* parallelscan_initialize)(Relation rel, ParallelTableScanDesc pscan)
Definition: tableam.h:376
bool(* scan_sample_next_tuple)(TableScanDesc scan, struct SampleScanState *scanstate, TupleTableSlot *slot)
Definition: tableam.h:849
void(* index_fetch_reset)(struct IndexFetchTableData *data)
Definition: tableam.h:406
void(* tuple_complete_speculative)(Relation rel, TupleTableSlot *slot, uint32 specToken, bool succeeded)
Definition: tableam.h:500
bool(* scan_bitmap_next_tuple)(TableScanDesc scan, struct TBMIterateResult *tbmres, TupleTableSlot *slot)
Definition: tableam.h:804
void(* parallelscan_reinitialize)(Relation rel, ParallelTableScanDesc pscan)
Definition: tableam.h:383
void(* tuple_get_latest_tid)(TableScanDesc scan, ItemPointer tid)
Definition: tableam.h:465
struct IndexFetchTableData *(* index_fetch_begin)(Relation rel)
Definition: tableam.h:400
bool(* scan_analyze_next_block)(TableScanDesc scan, BlockNumber blockno, BufferAccessStrategy bstrategy)
Definition: tableam.h:651
void(* relation_estimate_size)(Relation rel, int32 *attr_widths, BlockNumber *pages, double *tuples, double *allvisfrac)
Definition: tableam.h:749
double(* index_build_range_scan)(Relation table_rel, Relation index_rel, struct IndexInfo *index_info, bool allow_sync, bool anyvisible, bool progress, BlockNumber start_blockno, BlockNumber numblocks, IndexBuildCallback callback, void *callback_state, TableScanDesc scan)
Definition: tableam.h:670
TableScanDesc(* scan_begin)(Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key, ParallelTableScanDesc pscan, uint32 flags)
Definition: tableam.h:304
bool(* relation_needs_toast_table)(Relation rel)
Definition: tableam.h:713
bool(* tuple_tid_valid)(TableScanDesc scan, ItemPointer tid)
Definition: tableam.h:458
void(* multi_insert)(Relation rel, TupleTableSlot **slots, int nslots, CommandId cid, int options, struct BulkInsertStateData *bistate)
Definition: tableam.h:506
TM_Result(* tuple_update)(Relation rel, ItemPointer otid, TupleTableSlot *slot, CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, LockTupleMode *lockmode, bool *update_indexes)
Definition: tableam.h:520
void(* scan_end)(TableScanDesc scan)
Definition: tableam.h:314
uint64(* relation_size)(Relation rel, ForkNumber forkNumber)
Definition: tableam.h:703
TM_Result(* tuple_lock)(Relation rel, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, CommandId cid, LockTupleMode mode, LockWaitPolicy wait_policy, uint8 flags, TM_FailureData *tmfd)
Definition: tableam.h:532
bool(* scan_sample_next_block)(TableScanDesc scan, struct SampleScanState *scanstate)
Definition: tableam.h:833
void(* relation_copy_for_cluster)(Relation NewTable, Relation OldTable, Relation OldIndex, bool use_sort, TransactionId OldestXmin, TransactionId *xid_cutoff, MultiXactId *multi_cutoff, double *num_tuples, double *tups_vacuumed, double *tups_recently_dead)
Definition: tableam.h:604
void(* relation_nontransactional_truncate)(Relation rel)
Definition: tableam.h:592
void(* tuple_insert)(Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate)
Definition: tableam.h:487
void(* scan_rescan)(TableScanDesc scan, struct ScanKeyData *key, bool set_params, bool allow_strat, bool allow_sync, bool allow_pagemode)
Definition: tableam.h:320
bool(* tuple_fetch_row_version)(Relation rel, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot)
Definition: tableam.h:450
void(* relation_vacuum)(Relation rel, struct VacuumParams *params, BufferAccessStrategy bstrategy)
Definition: tableam.h:630
void(* relation_set_new_filenode)(Relation rel, const RelFileNode *newrnode, char persistence, TransactionId *freezeXid, MultiXactId *minmulti)
Definition: tableam.h:578
Size(* parallelscan_estimate)(Relation rel)
Definition: tableam.h:369
bool(* scan_analyze_next_tuple)(TableScanDesc scan, TransactionId OldestXmin, double *liverows, double *deadrows, TupleTableSlot *slot)
Definition: tableam.h:663
TransactionId(* index_delete_tuples)(Relation rel, TM_IndexDeleteOp *delstate)
Definition: tableam.h:477
void(* index_fetch_end)(struct IndexFetchTableData *data)
Definition: tableam.h:411
bool(* index_fetch_tuple)(struct IndexFetchTableData *scan, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, bool *call_again, bool *all_dead)
Definition: tableam.h:433
void(* tuple_insert_speculative)(Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate, uint32 specToken)
Definition: tableam.h:492
TM_Result(* tuple_delete)(Relation rel, ItemPointer tid, CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, bool changingPart)
Definition: tableam.h:510
bool(* scan_bitmap_next_block)(TableScanDesc scan, struct TBMIterateResult *tbmres)
Definition: tableam.h:790
void(* index_validate_scan)(Relation table_rel, Relation index_rel, struct IndexInfo *index_info, Snapshot snapshot, struct ValidateIndexState *state)
Definition: tableam.h:683
bool(* scan_getnextslot)(TableScanDesc scan, ScanDirection direction, TupleTableSlot *slot)
Definition: tableam.h:327
bool(* tuple_satisfies_snapshot)(Relation rel, TupleTableSlot *slot, Snapshot snapshot)
Definition: tableam.h:472
void(* relation_copy_data)(Relation rel, const RelFileNode *newrnode)
Definition: tableam.h:600

References Assert(), DatumGetPointer, elog, ERROR, TableAmRoutine::index_build_range_scan, TableAmRoutine::index_delete_tuples, TableAmRoutine::index_fetch_begin, TableAmRoutine::index_fetch_end, TableAmRoutine::index_fetch_reset, TableAmRoutine::index_fetch_tuple, TableAmRoutine::index_validate_scan, IsA, TableAmRoutine::multi_insert, OidFunctionCall0, TableAmRoutine::parallelscan_estimate, TableAmRoutine::parallelscan_initialize, TableAmRoutine::parallelscan_reinitialize, TableAmRoutine::relation_copy_data, TableAmRoutine::relation_copy_for_cluster, TableAmRoutine::relation_estimate_size, TableAmRoutine::relation_needs_toast_table, TableAmRoutine::relation_nontransactional_truncate, TableAmRoutine::relation_set_new_filenode, TableAmRoutine::relation_size, TableAmRoutine::relation_vacuum, TableAmRoutine::scan_analyze_next_block, TableAmRoutine::scan_analyze_next_tuple, TableAmRoutine::scan_begin, TableAmRoutine::scan_bitmap_next_block, TableAmRoutine::scan_bitmap_next_tuple, TableAmRoutine::scan_end, TableAmRoutine::scan_getnextslot, TableAmRoutine::scan_rescan, TableAmRoutine::scan_sample_next_block, TableAmRoutine::scan_sample_next_tuple, TableAmRoutine::tuple_complete_speculative, TableAmRoutine::tuple_delete, TableAmRoutine::tuple_fetch_row_version, TableAmRoutine::tuple_get_latest_tid, TableAmRoutine::tuple_insert, TableAmRoutine::tuple_insert_speculative, TableAmRoutine::tuple_lock, TableAmRoutine::tuple_satisfies_snapshot, TableAmRoutine::tuple_tid_valid, and TableAmRoutine::tuple_update.

Referenced by InitTableAmRoutine().

◆ simple_table_tuple_delete()

void simple_table_tuple_delete ( Relation  rel,
ItemPointer  tid,
Snapshot  snapshot 
)

Definition at line 301 of file tableam.c.

302 {
303  TM_Result result;
304  TM_FailureData tmfd;
305 
306  result = table_tuple_delete(rel, tid,
307  GetCurrentCommandId(true),
308  snapshot, InvalidSnapshot,
309  true /* wait for commit */ ,
310  &tmfd, false /* changingPart */ );
311 
312  switch (result)
313  {
314  case TM_SelfModified:
315  /* Tuple was already updated in current command? */
316  elog(ERROR, "tuple already updated by self");
317  break;
318 
319  case TM_Ok:
320  /* done successfully */
321  break;
322 
323  case TM_Updated:
324  elog(ERROR, "tuple concurrently updated");
325  break;
326 
327  case TM_Deleted:
328  elog(ERROR, "tuple concurrently deleted");
329  break;
330 
331  default:
332  elog(ERROR, "unrecognized table_tuple_delete status: %u", result);
333  break;
334  }
335 }
#define InvalidSnapshot
Definition: snapshot.h:123
static TM_Result table_tuple_delete(Relation rel, ItemPointer tid, CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, bool changingPart)
Definition: tableam.h:1462
CommandId GetCurrentCommandId(bool used)
Definition: xact.c:814

References elog, ERROR, GetCurrentCommandId(), InvalidSnapshot, table_tuple_delete(), TM_Deleted, TM_Ok, TM_SelfModified, and TM_Updated.

Referenced by ExecSimpleRelationDelete().

◆ simple_table_tuple_insert()

void simple_table_tuple_insert ( Relation  rel,
TupleTableSlot slot 
)

Definition at line 287 of file tableam.c.

288 {
289  table_tuple_insert(rel, slot, GetCurrentCommandId(true), 0, NULL);
290 }
static void table_tuple_insert(Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate)
Definition: tableam.h:1373

References GetCurrentCommandId(), and table_tuple_insert().

Referenced by ExecSimpleRelationInsert().

◆ simple_table_tuple_update()

void simple_table_tuple_update ( Relation  rel,
ItemPointer  otid,
TupleTableSlot slot,
Snapshot  snapshot,
bool update_indexes 
)

Definition at line 346 of file tableam.c.

350 {
351  TM_Result result;
352  TM_FailureData tmfd;
353  LockTupleMode lockmode;
354 
355  result = table_tuple_update(rel, otid, slot,
356  GetCurrentCommandId(true),
357  snapshot, InvalidSnapshot,
358  true /* wait for commit */ ,
359  &tmfd, &lockmode, update_indexes);
360 
361  switch (result)
362  {
363  case TM_SelfModified:
364  /* Tuple was already updated in current command? */
365  elog(ERROR, "tuple already updated by self");
366  break;
367 
368  case TM_Ok:
369  /* done successfully */
370  break;
371 
372  case TM_Updated:
373  elog(ERROR, "tuple concurrently updated");
374  break;
375 
376  case TM_Deleted:
377  elog(ERROR, "tuple concurrently deleted");
378  break;
379 
380  default:
381  elog(ERROR, "unrecognized table_tuple_update status: %u", result);
382  break;
383  }
384 }
LockTupleMode
Definition: lockoptions.h:50
static TM_Result table_tuple_update(Relation rel, ItemPointer otid, TupleTableSlot *slot, CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, LockTupleMode *lockmode, bool *update_indexes)
Definition: tableam.h:1506

References elog, ERROR, GetCurrentCommandId(), InvalidSnapshot, table_tuple_update(), TM_Deleted, TM_Ok, TM_SelfModified, and TM_Updated.

Referenced by ExecSimpleRelationUpdate().

◆ table_beginscan()

static TableScanDesc table_beginscan ( Relation  rel,
Snapshot  snapshot,
int  nkeys,
struct ScanKeyData key 
)
inlinestatic

◆ table_beginscan_analyze()

static TableScanDesc table_beginscan_analyze ( Relation  rel)
inlinestatic

Definition at line 982 of file tableam.h.

983 {
984  uint32 flags = SO_TYPE_ANALYZE;
985 
986  return rel->rd_tableam->scan_begin(rel, NULL, 0, NULL, NULL, flags);
987 }

References RelationData::rd_tableam, TableAmRoutine::scan_begin, and SO_TYPE_ANALYZE.

Referenced by acquire_sample_rows().

◆ table_beginscan_bm()

static TableScanDesc table_beginscan_bm ( Relation  rel,
Snapshot  snapshot,
int  nkeys,
struct ScanKeyData key 
)
inlinestatic

Definition at line 930 of file tableam.h.

932 {
934 
935  return rel->rd_tableam->scan_begin(rel, snapshot, nkeys, key, NULL, flags);
936 }

References sort-test::key, RelationData::rd_tableam, TableAmRoutine::scan_begin, SO_ALLOW_PAGEMODE, and SO_TYPE_BITMAPSCAN.

Referenced by ExecInitBitmapHeapScan().

◆ table_beginscan_catalog()

TableScanDesc table_beginscan_catalog ( Relation  rel,
int  nkeys,
struct ScanKeyData key 
)

Definition at line 112 of file tableam.c.

113 {
114  uint32 flags = SO_TYPE_SEQSCAN |
116  Oid relid = RelationGetRelid(relation);
117  Snapshot snapshot = RegisterSnapshot(GetCatalogSnapshot(relid));
118 
119  return relation->rd_tableam->scan_begin(relation, snapshot, nkeys, key,
120  NULL, flags);
121 }
unsigned int Oid
Definition: postgres_ext.h:31
#define RelationGetRelid(relation)
Definition: rel.h:489
Snapshot GetCatalogSnapshot(Oid relid)
Definition: snapmgr.c:386
Snapshot RegisterSnapshot(Snapshot snapshot)
Definition: snapmgr.c:827

References GetCatalogSnapshot(), sort-test::key, RelationData::rd_tableam, RegisterSnapshot(), RelationGetRelid, TableAmRoutine::scan_begin, SO_ALLOW_PAGEMODE, SO_ALLOW_STRAT, SO_ALLOW_SYNC, SO_TEMP_SNAPSHOT, and SO_TYPE_SEQSCAN.

Referenced by AlterTableMoveAll(), AlterTableSpaceOptions(), check_db_file_conflict(), CreateDatabaseUsingFileCopy(), do_autovacuum(), DropSetting(), DropTableSpace(), find_typed_table_dependencies(), get_all_vacuum_rels(), get_database_list(), get_subscription_list(), get_tables_to_cluster(), get_tablespace_name(), get_tablespace_oid(), GetAllTablesPublicationRelations(), getRelationsInNamespace(), GetSchemaPublicationRelations(), index_update_stats(), objectsInSchemaToOids(), populate_typ_list(), ReindexMultipleTables(), remove_dbtablespaces(), RemoveSubscriptionRel(), RenameTableSpace(), ThereIsAtLeastOneRole(), and vac_truncate_clog().

◆ table_beginscan_parallel()

TableScanDesc table_beginscan_parallel ( Relation  rel,
ParallelTableScanDesc  pscan 
)

Definition at line 175 of file tableam.c.

176 {
177  Snapshot snapshot;
178  uint32 flags = SO_TYPE_SEQSCAN |
180 
181  Assert(RelationGetRelid(relation) == parallel_scan->phs_relid);
182 
183  if (!parallel_scan->phs_snapshot_any)
184  {
185  /* Snapshot was serialized -- restore it */
186  snapshot = RestoreSnapshot((char *) parallel_scan +
187  parallel_scan->phs_snapshot_off);
188  RegisterSnapshot(snapshot);
189  flags |= SO_TEMP_SNAPSHOT;
190  }
191  else
192  {
193  /* SnapshotAny passed by caller (not serialized) */
194  snapshot = SnapshotAny;
195  }
196 
197  return relation->rd_tableam->scan_begin(relation, snapshot, 0, NULL,
198  parallel_scan, flags);
199 }
Snapshot RestoreSnapshot(char *start_address)
Definition: snapmgr.c:2204
#define SnapshotAny
Definition: snapmgr.h:67

References Assert(), ParallelTableScanDescData::phs_relid, ParallelTableScanDescData::phs_snapshot_any, ParallelTableScanDescData::phs_snapshot_off, RelationData::rd_tableam, RegisterSnapshot(), RelationGetRelid, RestoreSnapshot(), TableAmRoutine::scan_begin, SnapshotAny, SO_ALLOW_PAGEMODE, SO_ALLOW_STRAT, SO_ALLOW_SYNC, SO_TEMP_SNAPSHOT, and SO_TYPE_SEQSCAN.

Referenced by _bt_parallel_scan_and_sort(), ExecSeqScanInitializeDSM(), and ExecSeqScanInitializeWorker().

◆ table_beginscan_sampling()

static TableScanDesc table_beginscan_sampling ( Relation  rel,
Snapshot  snapshot,
int  nkeys,
struct ScanKeyData key,
bool  allow_strat,
bool  allow_sync,
bool  allow_pagemode 
)
inlinestatic

Definition at line 946 of file tableam.h.

950 {
951  uint32 flags = SO_TYPE_SAMPLESCAN;
952 
953  if (allow_strat)
954  flags |= SO_ALLOW_STRAT;
955  if (allow_sync)
956  flags |= SO_ALLOW_SYNC;
957  if (allow_pagemode)
958  flags |= SO_ALLOW_PAGEMODE;
959 
960  return rel->rd_tableam->scan_begin(rel, snapshot, nkeys, key, NULL, flags);
961 }

References sort-test::key, RelationData::rd_tableam, TableAmRoutine::scan_begin, SO_ALLOW_PAGEMODE, SO_ALLOW_STRAT, SO_ALLOW_SYNC, and SO_TYPE_SAMPLESCAN.

Referenced by tablesample_init().

◆ table_beginscan_strat()

static TableScanDesc table_beginscan_strat ( Relation  rel,
Snapshot  snapshot,
int  nkeys,
struct ScanKeyData key,
bool  allow_strat,
bool  allow_sync 
)
inlinestatic

Definition at line 909 of file tableam.h.

912 {
914 
915  if (allow_strat)
916  flags |= SO_ALLOW_STRAT;
917  if (allow_sync)
918  flags |= SO_ALLOW_SYNC;
919 
920  return rel->rd_tableam->scan_begin(rel, snapshot, nkeys, key, NULL, flags);
921 }

References sort-test::key, RelationData::rd_tableam, TableAmRoutine::scan_begin, SO_ALLOW_PAGEMODE, SO_ALLOW_STRAT, SO_ALLOW_SYNC, and SO_TYPE_SEQSCAN.

Referenced by bt_check_every_level(), heapam_index_build_range_scan(), heapam_index_validate_scan(), IndexCheckExclusion(), pgstat_heap(), and systable_beginscan().

◆ table_beginscan_tid()

static TableScanDesc table_beginscan_tid ( Relation  rel,
Snapshot  snapshot 
)
inlinestatic

Definition at line 969 of file tableam.h.

970 {
971  uint32 flags = SO_TYPE_TIDSCAN;
972 
973  return rel->rd_tableam->scan_begin(rel, snapshot, 0, NULL, NULL, flags);
974 }

References RelationData::rd_tableam, TableAmRoutine::scan_begin, and SO_TYPE_TIDSCAN.

Referenced by currtid_internal(), and TidListEval().

◆ table_beginscan_tidrange()

static TableScanDesc table_beginscan_tidrange ( Relation  rel,
Snapshot  snapshot,
ItemPointer  mintid,
ItemPointer  maxtid 
)
inlinestatic

Definition at line 1059 of file tableam.h.

1062 {
1063  TableScanDesc sscan;
1065 
1066  sscan = rel->rd_tableam->scan_begin(rel, snapshot, 0, NULL, NULL, flags);
1067 
1068  /* Set the range of TIDs to scan */
1069  sscan->rs_rd->rd_tableam->scan_set_tidrange(sscan, mintid, maxtid);
1070 
1071  return sscan;
1072 }
void(* scan_set_tidrange)(TableScanDesc scan, ItemPointer mintid, ItemPointer maxtid)
Definition: tableam.h:348
Relation rs_rd
Definition: relscan.h:34

References RelationData::rd_tableam, TableScanDescData::rs_rd, TableAmRoutine::scan_begin, TableAmRoutine::scan_set_tidrange, SO_ALLOW_PAGEMODE, and SO_TYPE_TIDRANGESCAN.

Referenced by TidRangeNext().

◆ table_block_parallelscan_estimate()

Size table_block_parallelscan_estimate ( Relation  rel)

Definition at line 393 of file tableam.c.

394 {
395  return sizeof(ParallelBlockTableScanDescData);
396 }
struct ParallelBlockTableScanDescData ParallelBlockTableScanDescData

◆ table_block_parallelscan_initialize()

Size table_block_parallelscan_initialize ( Relation  rel,
ParallelTableScanDesc  pscan 
)

Definition at line 399 of file tableam.c.

400 {
402 
403  bpscan->base.phs_relid = RelationGetRelid(rel);
404  bpscan->phs_nblocks = RelationGetNumberOfBlocks(rel);
405  /* compare phs_syncscan initialization to similar logic in initscan */
407  !RelationUsesLocalBuffers(rel) &&
408  bpscan->phs_nblocks > NBuffers / 4;
409  SpinLockInit(&bpscan->phs_mutex);
411  pg_atomic_init_u64(&bpscan->phs_nallocated, 0);
412 
413  return sizeof(ParallelBlockTableScanDescData);
414 }
static void pg_atomic_init_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
Definition: atomics.h:415
#define InvalidBlockNumber
Definition: block.h:33
#define RelationGetNumberOfBlocks(reln)
Definition: bufmgr.h:216
int NBuffers
Definition: globals.c:136
#define RelationUsesLocalBuffers(relation)
Definition: rel.h:622
struct ParallelBlockTableScanDescData * ParallelBlockTableScanDesc
Definition: relscan.h:85
#define SpinLockInit(lock)
Definition: spin.h:60
pg_atomic_uint64 phs_nallocated
Definition: relscan.h:82
ParallelTableScanDescData base
Definition: relscan.h:77
bool synchronize_seqscans
Definition: tableam.c:49

References ParallelBlockTableScanDescData::base, InvalidBlockNumber, NBuffers, pg_atomic_init_u64(), ParallelBlockTableScanDescData::phs_mutex, ParallelBlockTableScanDescData::phs_nallocated, ParallelBlockTableScanDescData::phs_nblocks, ParallelTableScanDescData::phs_relid, ParallelBlockTableScanDescData::phs_startblock, ParallelTableScanDescData::phs_syncscan, RelationGetNumberOfBlocks, RelationGetRelid, RelationUsesLocalBuffers, SpinLockInit, and synchronize_seqscans.

◆ table_block_parallelscan_nextpage()

BlockNumber table_block_parallelscan_nextpage ( Relation  rel,
ParallelBlockTableScanWorker  pbscanwork,
ParallelBlockTableScanDesc  pbscan 
)

Definition at line 502 of file tableam.c.

505 {
506  BlockNumber page;
507  uint64 nallocated;
508 
509  /*
510  * The logic below allocates block numbers out to parallel workers in a
511  * way that each worker will receive a set of consecutive block numbers to
512  * scan. Earlier versions of this would allocate the next highest block
513  * number to the next worker to call this function. This would generally
514  * result in workers never receiving consecutive block numbers. Some
515  * operating systems would not detect the sequential I/O pattern due to
516  * each backend being a different process which could result in poor
517  * performance due to inefficient or no readahead. To work around this
518  * issue, we now allocate a range of block numbers for each worker and
519  * when they come back for another block, we give them the next one in
520  * that range until the range is complete. When the worker completes the
521  * range of blocks we then allocate another range for it and return the
522  * first block number from that range.
523  *
524  * Here we name these ranges of blocks "chunks". The initial size of
525  * these chunks is determined in table_block_parallelscan_startblock_init
526  * based on the size of the relation. Towards the end of the scan, we
527  * start making reductions in the size of the chunks in order to attempt
528  * to divide the remaining work over all the workers as evenly as
529  * possible.
530  *
531  * Here pbscanwork is local worker memory. phsw_chunk_remaining tracks
532  * the number of blocks remaining in the chunk. When that reaches 0 then
533  * we must allocate a new chunk for the worker.
534  *
535  * phs_nallocated tracks how many blocks have been allocated to workers
536  * already. When phs_nallocated >= rs_nblocks, all blocks have been
537  * allocated.
538  *
539  * Because we use an atomic fetch-and-add to fetch the current value, the
540  * phs_nallocated counter will exceed rs_nblocks, because workers will
541  * still increment the value, when they try to allocate the next block but
542  * all blocks have been allocated already. The counter must be 64 bits
543  * wide because of that, to avoid wrapping around when rs_nblocks is close
544  * to 2^32.
545  *
546  * The actual block to return is calculated by adding the counter to the
547  * starting block number, modulo nblocks.
548  */
549 
550  /*
551  * First check if we have any remaining blocks in a previous chunk for
552  * this worker. We must consume all of the blocks from that before we
553  * allocate a new chunk to the worker.
554  */
555  if (pbscanwork->phsw_chunk_remaining > 0)
556  {
557  /*
558  * Give them the next block in the range and update the remaining
559  * number of blocks.
560  */
561  nallocated = ++pbscanwork->phsw_nallocated;
562  pbscanwork->phsw_chunk_remaining--;
563  }
564  else
565  {
566  /*
567  * When we've only got PARALLEL_SEQSCAN_RAMPDOWN_CHUNKS chunks
568  * remaining in the scan, we half the chunk size. Since we reduce the
569  * chunk size here, we'll hit this again after doing
570  * PARALLEL_SEQSCAN_RAMPDOWN_CHUNKS at the new size. After a few
571  * iterations of this, we'll end up doing the last few blocks with the
572  * chunk size set to 1.
573  */
574  if (pbscanwork->phsw_chunk_size > 1 &&
575  pbscanwork->phsw_nallocated > pbscan->phs_nblocks -
577  pbscanwork->phsw_chunk_size >>= 1;
578 
579  nallocated = pbscanwork->phsw_nallocated =
581  pbscanwork->phsw_chunk_size);
582 
583  /*
584  * Set the remaining number of blocks in this chunk so that subsequent
585  * calls from this worker continue on with this chunk until it's done.
586  */
587  pbscanwork->phsw_chunk_remaining = pbscanwork->phsw_chunk_size - 1;
588  }
589 
590  if (nallocated >= pbscan->phs_nblocks)
591  page = InvalidBlockNumber; /* all blocks have been allocated */
592  else
593  page = (nallocated + pbscan->phs_startblock) % pbscan->phs_nblocks;
594 
595  /*
596  * Report scan location. Normally, we report the current page number.
597  * When we reach the end of the scan, though, we report the starting page,
598  * not the ending page, just so the starting positions for later scans
599  * doesn't slew backwards. We only report the position at the end of the
600  * scan once, though: subsequent callers will report nothing.
601  */
602  if (pbscan->base.phs_syncscan)
603  {
604  if (page != InvalidBlockNumber)
605  ss_report_location(rel, page);
606  else if (nallocated == pbscan->phs_nblocks)
607  ss_report_location(rel, pbscan->phs_startblock);
608  }
609 
610  return page;
611 }
static uint64 pg_atomic_fetch_add_u64(volatile pg_atomic_uint64 *ptr, int64 add_)
Definition: atomics.h:467
uint32 BlockNumber
Definition: block.h:31
void ss_report_location(Relation rel, BlockNumber location)
Definition: syncscan.c:288
#define PARALLEL_SEQSCAN_RAMPDOWN_CHUNKS
Definition: tableam.c:43

References ParallelBlockTableScanDescData::base, if(), InvalidBlockNumber, PARALLEL_SEQSCAN_RAMPDOWN_CHUNKS, pg_atomic_fetch_add_u64(), ParallelBlockTableScanDescData::phs_nallocated, ParallelBlockTableScanDescData::phs_nblocks, ParallelBlockTableScanDescData::phs_startblock, ParallelTableScanDescData::phs_syncscan, ParallelBlockTableScanWorkerData::phsw_chunk_remaining, ParallelBlockTableScanWorkerData::phsw_chunk_size, ParallelBlockTableScanWorkerData::phsw_nallocated, and ss_report_location().

Referenced by heapgettup(), and heapgettup_pagemode().

◆ table_block_parallelscan_reinitialize()

void table_block_parallelscan_reinitialize ( Relation  rel,
ParallelTableScanDesc  pscan 
)

Definition at line 417 of file tableam.c.

418 {
420 
421  pg_atomic_write_u64(&bpscan->phs_nallocated, 0);
422 }
static void pg_atomic_write_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
Definition: atomics.h:438

References pg_atomic_write_u64(), and ParallelBlockTableScanDescData::phs_nallocated.

◆ table_block_parallelscan_startblock_init()

void table_block_parallelscan_startblock_init ( Relation  rel,
ParallelBlockTableScanWorker  pbscanwork,
ParallelBlockTableScanDesc  pbscan 
)

Definition at line 432 of file tableam.c.

435 {
436  BlockNumber sync_startpage = InvalidBlockNumber;
437 
438  /* Reset the state we use for controlling allocation size. */
439  memset(pbscanwork, 0, sizeof(*pbscanwork));
440 
441  StaticAssertStmt(MaxBlockNumber <= 0xFFFFFFFE,
442  "pg_nextpower2_32 may be too small for non-standard BlockNumber width");
443 
444  /*
445  * We determine the chunk size based on the size of the relation. First we
446  * split the relation into PARALLEL_SEQSCAN_NCHUNKS chunks but we then
447  * take the next highest power of 2 number of the chunk size. This means
448  * we split the relation into somewhere between PARALLEL_SEQSCAN_NCHUNKS
449  * and PARALLEL_SEQSCAN_NCHUNKS / 2 chunks.
450  */
451  pbscanwork->phsw_chunk_size = pg_nextpower2_32(Max(pbscan->phs_nblocks /
453 
454  /*
455  * Ensure we don't go over the maximum chunk size with larger tables. This
456  * means we may get much more than PARALLEL_SEQSCAN_NCHUNKS for larger
457  * tables. Too large a chunk size has been shown to be detrimental to
458  * synchronous scan performance.
459  */
460  pbscanwork->phsw_chunk_size = Min(pbscanwork->phsw_chunk_size,
462 
463 retry:
464  /* Grab the spinlock. */
465  SpinLockAcquire(&pbscan->phs_mutex);
466 
467  /*
468  * If the scan's startblock has not yet been initialized, we must do so
469  * now. If this is not a synchronized scan, we just start at block 0, but
470  * if it is a synchronized scan, we must get the starting position from
471  * the synchronized scan machinery. We can't hold the spinlock while
472  * doing that, though, so release the spinlock, get the information we
473  * need, and retry. If nobody else has initialized the scan in the
474  * meantime, we'll fill in the value we fetched on the second time
475  * through.
476  */
477  if (pbscan->phs_startblock == InvalidBlockNumber)
478  {
479  if (!pbscan->base.phs_syncscan)
480  pbscan->phs_startblock = 0;
481  else if (sync_startpage != InvalidBlockNumber)
482  pbscan->phs_startblock = sync_startpage;
483  else
484  {
485  SpinLockRelease(&pbscan->phs_mutex);
486  sync_startpage = ss_get_location(rel, pbscan->phs_nblocks);
487  goto retry;
488  }
489  }
490  SpinLockRelease(&pbscan->phs_mutex);
491 }
#define MaxBlockNumber
Definition: block.h:35
#define Min(x, y)
Definition: c.h:986
#define Max(x, y)
Definition: c.h:980
#define StaticAssertStmt(condition, errmessage)
Definition: c.h:918
static uint32 pg_nextpower2_32(uint32 num)
Definition: pg_bitutils.h:140
#define SpinLockRelease(lock)
Definition: spin.h:64
#define SpinLockAcquire(lock)
Definition: spin.h:62
BlockNumber ss_get_location(Relation rel, BlockNumber relnblocks)
Definition: syncscan.c:253
#define PARALLEL_SEQSCAN_MAX_CHUNK_SIZE
Definition: tableam.c:45
#define PARALLEL_SEQSCAN_NCHUNKS
Definition: tableam.c:41

References ParallelBlockTableScanDescData::base, InvalidBlockNumber, Max, MaxBlockNumber, Min, PARALLEL_SEQSCAN_MAX_CHUNK_SIZE, PARALLEL_SEQSCAN_NCHUNKS, pg_nextpower2_32(), ParallelBlockTableScanDescData::phs_mutex, ParallelBlockTableScanDescData::phs_nblocks, ParallelBlockTableScanDescData::phs_startblock, ParallelTableScanDescData::phs_syncscan, ParallelBlockTableScanWorkerData::phsw_chunk_size, SpinLockAcquire, SpinLockRelease, ss_get_location(), and StaticAssertStmt.

Referenced by heapgettup(), and heapgettup_pagemode().

◆ table_block_relation_estimate_size()

void table_block_relation_estimate_size ( Relation  rel,
int32 attr_widths,
BlockNumber pages,
double *  tuples,
double *  allvisfrac,
Size  overhead_bytes_per_tuple,
Size  usable_bytes_per_page 
)

Definition at line 664 of file tableam.c.

669 {
670  BlockNumber curpages;
671  BlockNumber relpages;
672  double reltuples;
673  BlockNumber relallvisible;
674  double density;
675 
676  /* it should have storage, so we can call the smgr */
677  curpages = RelationGetNumberOfBlocks(rel);
678 
679  /* coerce values in pg_class to more desirable types */
680  relpages = (BlockNumber) rel->rd_rel->relpages;
681  reltuples = (double) rel->rd_rel->reltuples;
682  relallvisible = (BlockNumber) rel->rd_rel->relallvisible;
683 
684  /*
685  * HACK: if the relation has never yet been vacuumed, use a minimum size
686  * estimate of 10 pages. The idea here is to avoid assuming a
687  * newly-created table is really small, even if it currently is, because
688  * that may not be true once some data gets loaded into it. Once a vacuum
689  * or analyze cycle has been done on it, it's more reasonable to believe
690  * the size is somewhat stable.
691  *
692  * (Note that this is only an issue if the plan gets cached and used again
693  * after the table has been filled. What we're trying to avoid is using a
694  * nestloop-type plan on a table that has grown substantially since the
695  * plan was made. Normally, autovacuum/autoanalyze will occur once enough
696  * inserts have happened and cause cached-plan invalidation; but that
697  * doesn't happen instantaneously, and it won't happen at all for cases
698  * such as temporary tables.)
699  *
700  * We test "never vacuumed" by seeing whether reltuples < 0.
701  *
702  * If the table has inheritance children, we don't apply this heuristic.
703  * Totally empty parent tables are quite common, so we should be willing
704  * to believe that they are empty.
705  */
706  if (curpages < 10 &&
707  reltuples < 0 &&
708  !rel->rd_rel->relhassubclass)
709  curpages = 10;
710 
711  /* report estimated # pages */
712  *pages = curpages;
713  /* quick exit if rel is clearly empty */
714  if (curpages == 0)
715  {
716  *tuples = 0;
717  *allvisfrac = 0;
718  return;
719  }
720 
721  /* estimate number of tuples from previous tuple density */
722  if (reltuples >= 0 && relpages > 0)
723  density = reltuples / (double) relpages;
724  else
725  {
726  /*
727  * When we have no data because the relation was never yet vacuumed,
728  * estimate tuple width from attribute datatypes. We assume here that
729  * the pages are completely full, which is OK for tables but is
730  * probably an overestimate for indexes. Fortunately
731  * get_relation_info() can clamp the overestimate to the parent
732  * table's size.
733  *
734  * Note: this code intentionally disregards alignment considerations,
735  * because (a) that would be gilding the lily considering how crude
736  * the estimate is, (b) it creates platform dependencies in the
737  * default plans which are kind of a headache for regression testing,
738  * and (c) different table AMs might use different padding schemes.
739  */
740  int32 tuple_width;
741 
742  tuple_width = get_rel_data_width(rel, attr_widths);
743  tuple_width += overhead_bytes_per_tuple;
744  /* note: integer division is intentional here */
745  density = usable_bytes_per_page / tuple_width;
746  }
747  *tuples = rint(density * (double) curpages);
748 
749  /*
750  * We use relallvisible as-is, rather than scaling it up like we do for
751  * the pages and tuples counts, on the theory that any pages added since
752  * the last VACUUM are most likely not marked all-visible. But costsize.c
753  * wants it converted to a fraction.
754  */
755  if (relallvisible == 0 || curpages <= 0)
756  *allvisfrac = 0;
757  else if ((double) relallvisible >= curpages)
758  *allvisfrac = 1;
759  else
760  *allvisfrac = (double) relallvisible / curpages;
761 }
signed int int32
Definition: c.h:429
int32 get_rel_data_width(Relation rel, int32 *attr_widths)
Definition: plancat.c:1085
Form_pg_class rd_rel
Definition: rel.h:109

References get_rel_data_width(), if(), RelationData::rd_rel, and RelationGetNumberOfBlocks.

Referenced by heapam_estimate_rel_size().

◆ table_block_relation_size()

uint64 table_block_relation_size ( Relation  rel,
ForkNumber  forkNumber 
)

Definition at line 627 of file tableam.c.

628 {
629  uint64 nblocks = 0;
630 
631  /* InvalidForkNumber indicates returning the size for all forks */
632  if (forkNumber == InvalidForkNumber)
633  {
634  for (int i = 0; i < MAX_FORKNUM; i++)
635  nblocks += smgrnblocks(RelationGetSmgr(rel), i);
636  }
637  else
638  nblocks = smgrnblocks(RelationGetSmgr(rel), forkNumber);
639 
640  return nblocks * BLCKSZ;
641 }
int i
Definition: isn.c:73
static SMgrRelation RelationGetSmgr(Relation rel)
Definition: rel.h:556
@ InvalidForkNumber
Definition: relpath.h:42
#define MAX_FORKNUM
Definition: relpath.h:55
BlockNumber smgrnblocks(SMgrRelation reln, ForkNumber forknum)
Definition: smgr.c:579

References i, InvalidForkNumber, MAX_FORKNUM, RelationGetSmgr(), and smgrnblocks().

◆ table_endscan()

◆ table_finish_bulk_insert()

static void table_finish_bulk_insert ( Relation  rel,
int  options 
)
inlinestatic

Definition at line 1566 of file tableam.h.

1567 {
1568  /* optional callback */
1569  if (rel->rd_tableam && rel->rd_tableam->finish_bulk_insert)
1571 }
void(* finish_bulk_insert)(Relation rel, int options)
Definition: tableam.h:554

References TableAmRoutine::finish_bulk_insert, and RelationData::rd_tableam.

Referenced by ATRewriteTable(), CopyMultiInsertBufferCleanup(), intorel_shutdown(), and transientrel_shutdown().

◆ table_index_build_range_scan()

static double table_index_build_range_scan ( Relation  table_rel,
Relation  index_rel,
struct IndexInfo index_info,
bool  allow_sync,
bool  anyvisible,
bool  progress,
BlockNumber  start_blockno,
BlockNumber  numblocks,
IndexBuildCallback  callback,
void *  callback_state,
TableScanDesc  scan 
)
inlinestatic

Definition at line 1780 of file tableam.h.

1791 {
1792  return table_rel->rd_tableam->index_build_range_scan(table_rel,
1793  index_rel,
1794  index_info,
1795  allow_sync,
1796  anyvisible,
1797  progress,
1798  start_blockno,
1799  numblocks,
1800  callback,
1801  callback_state,
1802  scan);
1803 }
int progress
Definition: pgbench.c:274
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
Definition: test_ifaddrs.c:48

References callback(), TableAmRoutine::index_build_range_scan, progress, and RelationData::rd_tableam.

Referenced by summarize_range().

◆ table_index_build_scan()

static double table_index_build_scan ( Relation  table_rel,
Relation  index_rel,
struct IndexInfo index_info,
bool  allow_sync,
bool  progress,
IndexBuildCallback  callback,
void *  callback_state,
TableScanDesc  scan 
)
inlinestatic

Definition at line 1747 of file tableam.h.

1755 {
1756  return table_rel->rd_tableam->index_build_range_scan(table_rel,
1757  index_rel,
1758  index_info,
1759  allow_sync,
1760  false,
1761  progress,
1762  0,
1764  callback,
1765  callback_state,
1766  scan);
1767 }

References callback(), TableAmRoutine::index_build_range_scan, InvalidBlockNumber, progress, and RelationData::rd_tableam.

Referenced by _bt_parallel_scan_and_sort(), _bt_spools_heapscan(), blbuild(), brinbuild(), bt_check_every_level(), ginbuild(), gistbuild(), hashbuild(), and spgbuild().

◆ table_index_delete_tuples()

static TransactionId table_index_delete_tuples ( Relation  rel,
TM_IndexDeleteOp delstate 
)
inlinestatic

Definition at line 1327 of file tableam.h.

1328 {
1329  return rel->rd_tableam->index_delete_tuples(rel, delstate);
1330 }

References TableAmRoutine::index_delete_tuples, and RelationData::rd_tableam.

Referenced by _bt_delitems_delete_check(), and index_compute_xid_horizon_for_tuples().

◆ table_index_fetch_begin()

static IndexFetchTableData* table_index_fetch_begin ( Relation  rel)
inlinestatic

Definition at line 1163 of file tableam.h.

1164 {
1165  return rel->rd_tableam->index_fetch_begin(rel);
1166 }

References TableAmRoutine::index_fetch_begin, and RelationData::rd_tableam.

Referenced by index_beginscan(), index_beginscan_parallel(), and table_index_fetch_tuple_check().

◆ table_index_fetch_end()

static void table_index_fetch_end ( struct IndexFetchTableData scan)
inlinestatic

Definition at line 1182 of file tableam.h.

1183 {
1184  scan->rel->rd_tableam->index_fetch_end(scan);
1185 }

References TableAmRoutine::index_fetch_end, RelationData::rd_tableam, and IndexFetchTableData::rel.

Referenced by index_endscan(), and table_index_fetch_tuple_check().

◆ table_index_fetch_reset()

static void table_index_fetch_reset ( struct IndexFetchTableData scan)
inlinestatic

◆ table_index_fetch_tuple()

static bool table_index_fetch_tuple ( struct IndexFetchTableData scan,
ItemPointer  tid,
Snapshot  snapshot,
TupleTableSlot slot,
bool call_again,
bool all_dead 
)
inlinestatic

Definition at line 1212 of file tableam.h.

1217 {
1218  /*
1219  * We don't expect direct calls to table_index_fetch_tuple with valid
1220  * CheckXidAlive for catalog or regular tables. See detailed comments in
1221  * xact.c where these variables are declared.
1222  */
1224  elog(ERROR, "unexpected table_index_fetch_tuple call during logical decoding");
1225 
1226  return scan->rel->rd_tableam->index_fetch_tuple(scan, tid, snapshot,
1227  slot, call_again,
1228  all_dead);
1229 }
#define unlikely(x)
Definition: c.h:273
#define TransactionIdIsValid(xid)
Definition: transam.h:41
bool bsysscan
Definition: xact.c:99
TransactionId CheckXidAlive
Definition: xact.c:98

References bsysscan, CheckXidAlive, elog, ERROR, TableAmRoutine::index_fetch_tuple, RelationData::rd_tableam, IndexFetchTableData::rel, TransactionIdIsValid, and unlikely.

Referenced by index_fetch_heap(), and table_index_fetch_tuple_check().

◆ table_index_fetch_tuple_check()

bool table_index_fetch_tuple_check ( Relation  rel,
ItemPointer  tid,
Snapshot  snapshot,
bool all_dead 
)

Definition at line 219 of file tableam.c.

223 {
224  IndexFetchTableData *scan;
225  TupleTableSlot *slot;
226  bool call_again = false;
227  bool found;
228 
229  slot = table_slot_create(rel, NULL);
230  scan = table_index_fetch_begin(rel);
231  found = table_index_fetch_tuple(scan, tid, snapshot, slot, &call_again,
232  all_dead);
233  table_index_fetch_end(scan);
235 
236  return found;
237 }
void ExecDropSingleTupleTableSlot(TupleTableSlot *slot)
Definition: execTuples.c:1254
TupleTableSlot * table_slot_create(Relation relation, List **reglist)
Definition: tableam.c:91
static IndexFetchTableData * table_index_fetch_begin(Relation rel)
Definition: tableam.h:1163
static void table_index_fetch_end(struct IndexFetchTableData *scan)
Definition: tableam.h:1182
static bool table_index_fetch_tuple(struct IndexFetchTableData *scan, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, bool *call_again, bool *all_dead)
Definition: tableam.h:1212

References ExecDropSingleTupleTableSlot(), table_index_fetch_begin(), table_index_fetch_end(), table_index_fetch_tuple(), and table_slot_create().

Referenced by _bt_check_unique().

◆ table_index_validate_scan()

static void table_index_validate_scan ( Relation  table_rel,
Relation  index_rel,
struct IndexInfo index_info,
Snapshot  snapshot,
struct ValidateIndexState state 
)
inlinestatic

Definition at line 1811 of file tableam.h.

1816 {
1817  table_rel->rd_tableam->index_validate_scan(table_rel,
1818  index_rel,
1819  index_info,
1820  snapshot,
1821  state);
1822 }
Definition: regguts.h:318

References TableAmRoutine::index_validate_scan, and RelationData::rd_tableam.

Referenced by validate_index().

◆ table_multi_insert()

static void table_multi_insert ( Relation  rel,
TupleTableSlot **  slots,
int  nslots,
CommandId  cid,
int  options,
struct BulkInsertStateData bistate 
)
inlinestatic

Definition at line 1428 of file tableam.h.

1430 {
1431  rel->rd_tableam->multi_insert(rel, slots, nslots,
1432  cid, options, bistate);
1433 }

References TableAmRoutine::multi_insert, and RelationData::rd_tableam.

Referenced by CopyMultiInsertBufferFlush().

◆ table_parallelscan_estimate()

Size table_parallelscan_estimate ( Relation  rel,
Snapshot  snapshot 
)

Definition at line 140 of file tableam.c.

141 {
142  Size sz = 0;
143 
144  if (IsMVCCSnapshot(snapshot))
145  sz = add_size(sz, EstimateSnapshotSpace(snapshot));
146  else
147  Assert(snapshot == SnapshotAny);
148 
149  sz = add_size(sz, rel->rd_tableam->parallelscan_estimate(rel));
150 
151  return sz;
152 }
size_t Size
Definition: c.h:540
Size add_size(Size s1, Size s2)
Definition: shmem.c:502
Size EstimateSnapshotSpace(Snapshot snap)
Definition: snapmgr.c:2121
#define IsMVCCSnapshot(snapshot)
Definition: snapmgr.h:96

References add_size(), Assert(), EstimateSnapshotSpace(), IsMVCCSnapshot, TableAmRoutine::parallelscan_estimate, RelationData::rd_tableam, and SnapshotAny.

Referenced by _bt_parallel_estimate_shared(), and ExecSeqScanEstimate().

◆ table_parallelscan_initialize()

void table_parallelscan_initialize ( Relation  rel,
ParallelTableScanDesc  pscan,
Snapshot  snapshot 
)

Definition at line 155 of file tableam.c.

157 {
158  Size snapshot_off = rel->rd_tableam->parallelscan_initialize(rel, pscan);
159 
160  pscan->phs_snapshot_off = snapshot_off;
161 
162  if (IsMVCCSnapshot(snapshot))
163  {
164  SerializeSnapshot(snapshot, (char *) pscan + pscan->phs_snapshot_off);
165  pscan->phs_snapshot_any = false;
166  }
167  else
168  {
169  Assert(snapshot == SnapshotAny);
170  pscan->phs_snapshot_any = true;
171  }
172 }
void SerializeSnapshot(Snapshot snapshot, char *start_address)
Definition: snapmgr.c:2145

References Assert(), IsMVCCSnapshot, TableAmRoutine::parallelscan_initialize, ParallelTableScanDescData::phs_snapshot_any, ParallelTableScanDescData::phs_snapshot_off, RelationData::rd_tableam, SerializeSnapshot(), and SnapshotAny.

Referenced by _bt_begin_parallel(), and ExecSeqScanInitializeDSM().

◆ table_parallelscan_reinitialize()

static void table_parallelscan_reinitialize ( Relation  rel,
ParallelTableScanDesc  pscan 
)
inlinestatic

Definition at line 1145 of file tableam.h.

1146 {
1147  rel->rd_tableam->parallelscan_reinitialize(rel, pscan);
1148 }

References TableAmRoutine::parallelscan_reinitialize, and RelationData::rd_tableam.

Referenced by ExecSeqScanReInitializeDSM().

◆ table_relation_copy_data()

static void table_relation_copy_data ( Relation  rel,
const RelFileNode newrnode 
)
inlinestatic

Definition at line 1621 of file tableam.h.

1622 {
1623  rel->rd_tableam->relation_copy_data(rel, newrnode);
1624 }

References RelationData::rd_tableam, and TableAmRoutine::relation_copy_data.

Referenced by ATExecSetTableSpace().

◆ table_relation_copy_for_cluster()

static void table_relation_copy_for_cluster ( Relation  OldTable,
Relation  NewTable,
Relation  OldIndex,
bool  use_sort,
TransactionId  OldestXmin,
TransactionId xid_cutoff,
MultiXactId multi_cutoff,
double *  num_tuples,
double *  tups_vacuumed,
double *  tups_recently_dead 
)
inlinestatic

Definition at line 1648 of file tableam.h.

1657 {
1658  OldTable->rd_tableam->relation_copy_for_cluster(OldTable, NewTable, OldIndex,
1659  use_sort, OldestXmin,
1660  xid_cutoff, multi_cutoff,
1661  num_tuples, tups_vacuumed,
1662  tups_recently_dead);
1663 }

References RelationData::rd_tableam, and TableAmRoutine::relation_copy_for_cluster.

Referenced by copy_table_data().

◆ table_relation_estimate_size()

static void table_relation_estimate_size ( Relation  rel,
int32 attr_widths,
BlockNumber pages,
double *  tuples,
double *  allvisfrac 
)
inlinestatic

Definition at line 1909 of file tableam.h.

1912 {
1913  rel->rd_tableam->relation_estimate_size(rel, attr_widths, pages, tuples,
1914  allvisfrac);
1915 }

References RelationData::rd_tableam, and TableAmRoutine::relation_estimate_size.

Referenced by estimate_rel_size().

◆ table_relation_fetch_toast_slice()

static void table_relation_fetch_toast_slice ( Relation  toastrel,
Oid  valueid,
int32  attrsize,
int32  sliceoffset,
int32  slicelength,
struct varlena result 
)
inlinestatic

Definition at line 1888 of file tableam.h.

1891 {
1892  toastrel->rd_tableam->relation_fetch_toast_slice(toastrel, valueid,
1893  attrsize,
1894  sliceoffset, slicelength,
1895  result);
1896 }
void(* relation_fetch_toast_slice)(Relation toastrel, Oid valueid, int32 attrsize, int32 sliceoffset, int32 slicelength, struct varlena *result)
Definition: tableam.h:727

References RelationData::rd_tableam, and TableAmRoutine::relation_fetch_toast_slice.

Referenced by toast_fetch_datum(), and toast_fetch_datum_slice().

◆ table_relation_needs_toast_table()

static bool table_relation_needs_toast_table ( Relation  rel)
inlinestatic

Definition at line 1849 of file tableam.h.

1850 {
1851  return rel->rd_tableam->relation_needs_toast_table(rel);
1852 }

References RelationData::rd_tableam, and TableAmRoutine::relation_needs_toast_table.

Referenced by needs_toast_table().

◆ table_relation_nontransactional_truncate()

static void table_relation_nontransactional_truncate ( Relation  rel)
inlinestatic

Definition at line 1609 of file tableam.h.

1610 {
1612 }

References RelationData::rd_tableam, and TableAmRoutine::relation_nontransactional_truncate.

Referenced by heap_truncate_one_rel().

◆ table_relation_set_new_filenode()

static void table_relation_set_new_filenode ( Relation  rel,
const RelFileNode newrnode,
char  persistence,
TransactionId freezeXid,
MultiXactId minmulti 
)
inlinestatic

Definition at line 1592 of file tableam.h.

1597 {
1598  rel->rd_tableam->relation_set_new_filenode(rel, newrnode, persistence,
1599  freezeXid, minmulti);
1600 }

References RelationData::rd_tableam, and TableAmRoutine::relation_set_new_filenode.

Referenced by heap_create(), and RelationSetNewRelfilenode().

◆ table_relation_size()

static uint64 table_relation_size ( Relation  rel,
ForkNumber  forkNumber 
)
inlinestatic

Definition at line 1840 of file tableam.h.

1841 {
1842  return rel->rd_tableam->relation_size(rel, forkNumber);
1843 }

References RelationData::rd_tableam, and TableAmRoutine::relation_size.

Referenced by RelationGetNumberOfBlocksInFork().

◆ table_relation_toast_am()

static Oid table_relation_toast_am ( Relation  rel)
inlinestatic

Definition at line 1859 of file tableam.h.

1860 {
1861  return rel->rd_tableam->relation_toast_am(rel);
1862 }
Oid(* relation_toast_am)(Relation rel)
Definition: tableam.h:720

References RelationData::rd_tableam, and TableAmRoutine::relation_toast_am.

Referenced by create_toast_table().

◆ table_relation_vacuum()

static void table_relation_vacuum ( Relation  rel,
struct VacuumParams params,
BufferAccessStrategy  bstrategy 
)
inlinestatic

Definition at line 1677 of file tableam.h.

1679 {
1680  rel->rd_tableam->relation_vacuum(rel, params, bstrategy);
1681 }

References RelationData::rd_tableam, and TableAmRoutine::relation_vacuum.

Referenced by vacuum_rel().

◆ table_rescan()

static void table_rescan ( TableScanDesc  scan,
struct ScanKeyData key 
)
inlinestatic

Definition at line 1002 of file tableam.h.

1004 {
1005  scan->rs_rd->rd_tableam->scan_rescan(scan, key, false, false, false, false);
1006 }

References sort-test::key, RelationData::rd_tableam, TableScanDescData::rs_rd, and TableAmRoutine::scan_rescan.

Referenced by ExecReScanBitmapHeapScan(), ExecReScanSeqScan(), ExecReScanTidScan(), and RelationFindReplTupleSeq().

◆ table_rescan_set_params()

static void table_rescan_set_params ( TableScanDesc  scan,
struct ScanKeyData key,
bool  allow_strat,
bool  allow_sync,
bool  allow_pagemode 
)
inlinestatic

Definition at line 1017 of file tableam.h.

1019 {
1020  scan->rs_rd->rd_tableam->scan_rescan(scan, key, true,
1021  allow_strat, allow_sync,
1022  allow_pagemode);
1023 }

References sort-test::key, RelationData::rd_tableam, TableScanDescData::rs_rd, and TableAmRoutine::scan_rescan.

Referenced by tablesample_init().

◆ table_rescan_tidrange()

static void table_rescan_tidrange ( TableScanDesc  sscan,
ItemPointer  mintid,
ItemPointer  maxtid 
)
inlinestatic

Definition at line 1080 of file tableam.h.

1082 {
1083  /* Ensure table_beginscan_tidrange() was used. */
1084  Assert((sscan->rs_flags & SO_TYPE_TIDRANGESCAN) != 0);
1085 
1086  sscan->rs_rd->rd_tableam->scan_rescan(sscan, NULL, false, false, false, false);
1087  sscan->rs_rd->rd_tableam->scan_set_tidrange(sscan, mintid, maxtid);
1088 }
uint32 rs_flags
Definition: relscan.h:47

References Assert(), RelationData::rd_tableam, TableScanDescData::rs_flags, TableScanDescData::rs_rd, TableAmRoutine::scan_rescan, TableAmRoutine::scan_set_tidrange, and SO_TYPE_TIDRANGESCAN.

Referenced by TidRangeNext().

◆ table_scan_analyze_next_block()

static bool table_scan_analyze_next_block ( TableScanDesc  scan,
BlockNumber  blockno,
BufferAccessStrategy  bstrategy 
)
inlinestatic

Definition at line 1692 of file tableam.h.

1694 {
1695  return scan->rs_rd->rd_tableam->scan_analyze_next_block(scan, blockno,
1696  bstrategy);
1697 }

References RelationData::rd_tableam, TableScanDescData::rs_rd, and TableAmRoutine::scan_analyze_next_block.

Referenced by acquire_sample_rows().

◆ table_scan_analyze_next_tuple()

static bool table_scan_analyze_next_tuple ( TableScanDesc  scan,
TransactionId  OldestXmin,
double *  liverows,
double *  deadrows,
TupleTableSlot slot 
)
inlinestatic

Definition at line 1710 of file tableam.h.

1713 {
1714  return scan->rs_rd->rd_tableam->scan_analyze_next_tuple(scan, OldestXmin,
1715  liverows, deadrows,
1716  slot);
1717 }

References RelationData::rd_tableam, TableScanDescData::rs_rd, and TableAmRoutine::scan_analyze_next_tuple.

Referenced by acquire_sample_rows().

◆ table_scan_bitmap_next_block()

static bool table_scan_bitmap_next_block ( TableScanDesc  scan,
struct TBMIterateResult tbmres 
)
inlinestatic

Definition at line 1933 of file tableam.h.

1935 {
1936  /*
1937  * We don't expect direct calls to table_scan_bitmap_next_block with valid
1938  * CheckXidAlive for catalog or regular tables. See detailed comments in
1939  * xact.c where these variables are declared.
1940  */
1942  elog(ERROR, "unexpected table_scan_bitmap_next_block call during logical decoding");
1943 
1944  return scan->rs_rd->rd_tableam->scan_bitmap_next_block(scan,
1945  tbmres);
1946 }

References bsysscan, CheckXidAlive, elog, ERROR, RelationData::rd_tableam, TableScanDescData::rs_rd, TableAmRoutine::scan_bitmap_next_block, TransactionIdIsValid, and unlikely.

Referenced by BitmapHeapNext().

◆ table_scan_bitmap_next_tuple()

static bool table_scan_bitmap_next_tuple ( TableScanDesc  scan,
struct TBMIterateResult tbmres,
TupleTableSlot slot 
)
inlinestatic

Definition at line 1957 of file tableam.h.

1960 {
1961  /*
1962  * We don't expect direct calls to table_scan_bitmap_next_tuple with valid
1963  * CheckXidAlive for catalog or regular tables. See detailed comments in
1964  * xact.c where these variables are declared.
1965  */
1967  elog(ERROR, "unexpected table_scan_bitmap_next_tuple call during logical decoding");
1968 
1969  return scan->rs_rd->rd_tableam->scan_bitmap_next_tuple(scan,
1970  tbmres,
1971  slot);
1972 }

References bsysscan, CheckXidAlive, elog, ERROR, RelationData::rd_tableam, TableScanDescData::rs_rd, TableAmRoutine::scan_bitmap_next_tuple, TransactionIdIsValid, and unlikely.

Referenced by BitmapHeapNext().

◆ table_scan_getnextslot()

static bool table_scan_getnextslot ( TableScanDesc  sscan,
ScanDirection  direction,
TupleTableSlot slot 
)
inlinestatic

Definition at line 1034 of file tableam.h.

1035 {
1036  slot->tts_tableOid = RelationGetRelid(sscan->rs_rd);
1037 
1038  /*
1039  * We don't expect direct calls to table_scan_getnextslot with valid
1040  * CheckXidAlive for catalog or regular tables. See detailed comments in
1041  * xact.c where these variables are declared.
1042  */
1044  elog(ERROR, "unexpected table_scan_getnextslot call during logical decoding");
1045 
1046  return sscan->rs_rd->rd_tableam->scan_getnextslot(sscan, direction, slot);
1047 }
Oid tts_tableOid
Definition: tuptable.h:131

References bsysscan, CheckXidAlive, elog, ERROR, RelationData::rd_tableam, RelationGetRelid, TableScanDescData::rs_rd, TableAmRoutine::scan_getnextslot, TransactionIdIsValid, TupleTableSlot::tts_tableOid, and unlikely.

Referenced by AlterDomainNotNull(), ATRewriteTable(), check_default_partition_contents(), DefineQueryRewrite(), DoCopyTo(), heapam_relation_copy_for_cluster(), IndexCheckExclusion(), RelationFindReplTupleSeq(), SeqNext(), systable_getnext(), validateDomainConstraint(), and validateForeignKeyConstraint().

◆ table_scan_getnextslot_tidrange()

static bool table_scan_getnextslot_tidrange ( TableScanDesc  sscan,
ScanDirection  direction,
TupleTableSlot slot 
)
inlinestatic

Definition at line 1096 of file tableam.h.

1098 {
1099  /* Ensure table_beginscan_tidrange() was used. */
1100  Assert((sscan->rs_flags & SO_TYPE_TIDRANGESCAN) != 0);
1101 
1102  return sscan->rs_rd->rd_tableam->scan_getnextslot_tidrange(sscan,
1103  direction,
1104  slot);
1105 }
bool(* scan_getnextslot_tidrange)(TableScanDesc scan, ScanDirection direction, TupleTableSlot *slot)
Definition: tableam.h:356

References Assert(), RelationData::rd_tableam, TableScanDescData::rs_flags, TableScanDescData::rs_rd, TableAmRoutine::scan_getnextslot_tidrange, and SO_TYPE_TIDRANGESCAN.

Referenced by TidRangeNext().

◆ table_scan_sample_next_block()

static bool table_scan_sample_next_block ( TableScanDesc  scan,
struct SampleScanState scanstate 
)
inlinestatic

Definition at line 1984 of file tableam.h.

1986 {
1987  /*
1988  * We don't expect direct calls to table_scan_sample_next_block with valid
1989  * CheckXidAlive for catalog or regular tables. See detailed comments in
1990  * xact.c where these variables are declared.
1991  */
1993  elog(ERROR, "unexpected table_scan_sample_next_block call during logical decoding");
1994  return scan->rs_rd->rd_tableam->scan_sample_next_block(scan, scanstate);
1995 }

References bsysscan, CheckXidAlive, elog, ERROR, RelationData::rd_tableam, TableScanDescData::rs_rd, TableAmRoutine::scan_sample_next_block, TransactionIdIsValid, and unlikely.

Referenced by tablesample_getnext().

◆ table_scan_sample_next_tuple()

static bool table_scan_sample_next_tuple ( TableScanDesc  scan,
struct SampleScanState scanstate,
TupleTableSlot slot 
)
inlinestatic

Definition at line 2006 of file tableam.h.

2009 {
2010  /*
2011  * We don't expect direct calls to table_scan_sample_next_tuple with valid
2012  * CheckXidAlive for catalog or regular tables. See detailed comments in
2013  * xact.c where these variables are declared.
2014  */
2016  elog(ERROR, "unexpected table_scan_sample_next_tuple call during logical decoding");
2017  return scan->rs_rd->rd_tableam->scan_sample_next_tuple(scan, scanstate,
2018  slot);
2019 }

References bsysscan, CheckXidAlive, elog, ERROR, RelationData::rd_tableam, TableScanDescData::rs_rd, TableAmRoutine::scan_sample_next_tuple, TransactionIdIsValid, and unlikely.

Referenced by tablesample_getnext().

◆ table_scan_update_snapshot()

void table_scan_update_snapshot ( TableScanDesc  scan,
Snapshot  snapshot 
)

Definition at line 124 of file tableam.c.

125 {
126  Assert(IsMVCCSnapshot(snapshot));
127 
128  RegisterSnapshot(snapshot);
129  scan->rs_snapshot = snapshot;
130  scan->rs_flags |= SO_TEMP_SNAPSHOT;
131 }
struct SnapshotData * rs_snapshot
Definition: relscan.h:35

References Assert(), IsMVCCSnapshot, RegisterSnapshot(), TableScanDescData::rs_flags, TableScanDescData::rs_snapshot, and SO_TEMP_SNAPSHOT.

Referenced by ExecBitmapHeapInitializeWorker().

◆ table_slot_callbacks()

const TupleTableSlotOps* table_slot_callbacks ( Relation  rel)

Definition at line 58 of file tableam.c.

59 {
60  const TupleTableSlotOps *tts_cb;
61 
62  if (relation->rd_tableam)
63  tts_cb = relation->rd_tableam->slot_callbacks(relation);
64  else if (relation->rd_rel->relkind == RELKIND_FOREIGN_TABLE)
65  {
66  /*
67  * Historically FDWs expect to store heap tuples in slots. Continue
68  * handing them one, to make it less painful to adapt FDWs to new
69  * versions. The cost of a heap slot over a virtual slot is pretty
70  * small.
71  */
72  tts_cb = &TTSOpsHeapTuple;
73  }
74  else
75  {
76  /*
77  * These need to be supported, as some parts of the code (like COPY)
78  * need to create slots for such relations too. It seems better to
79  * centralize the knowledge that a heap slot is the right thing in
80  * that case here.
81  */
82  Assert(relation->rd_rel->relkind == RELKIND_VIEW ||
83  relation->rd_rel->relkind == RELKIND_PARTITIONED_TABLE);
84  tts_cb = &TTSOpsVirtual;
85  }
86 
87  return tts_cb;
88 }
const TupleTableSlotOps TTSOpsVirtual
Definition: execTuples.c:83
const TupleTableSlotOps TTSOpsHeapTuple
Definition: execTuples.c:84

References Assert(), RelationData::rd_rel, RelationData::rd_tableam, TableAmRoutine::slot_callbacks, TTSOpsHeapTuple, and TTSOpsVirtual.

Referenced by ATRewriteTable(), ExecGetReturningSlot(), ExecGetTriggerNewSlot(), ExecGetTriggerOldSlot(), ExecInitBitmapHeapScan(), ExecInitIndexOnlyScan(), ExecInitIndexScan(), ExecInitSampleScan(), ExecInitSeqScan(), ExecInitTidRangeScan(), ExecInitTidScan(), and table_slot_create().

◆ table_slot_create()

TupleTableSlot* table_slot_create ( Relation  rel,
List **  reglist 
)

Definition at line 91 of file tableam.c.

92 {
93  const TupleTableSlotOps *tts_cb;
94  TupleTableSlot *slot;
95 
96  tts_cb = table_slot_callbacks(relation);
97  slot = MakeSingleTupleTableSlot(RelationGetDescr(relation), tts_cb);
98 
99  if (reglist)
100  *reglist = lappend(*reglist, slot);
101 
102  return slot;
103 }
TupleTableSlot * MakeSingleTupleTableSlot(TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1238
List * lappend(List *list, void *datum)
Definition: list.c:336
#define RelationGetDescr(relation)
Definition: rel.h:515
const TupleTableSlotOps * table_slot_callbacks(Relation relation)
Definition: tableam.c:58

References lappend(), MakeSingleTupleTableSlot(), RelationGetDescr, and table_slot_callbacks().

Referenced by acquire_sample_rows(), AlterDomainNotNull(), apply_handle_tuple_routing(), check_default_partition_contents(), check_exclusion_or_unique_constraint(), CopyFrom(), CopyMultiInsertInfoNextFreeSlot(), DefineQueryRewrite(), DoCopyTo(), EvalPlanQualSlot(), ExecCrossPartitionUpdate(), ExecInitInsertProjection(), ExecInitMerge(), ExecInitMergeTupleSlots(), ExecInitModifyTable(), ExecInitPartitionInfo(), ExecInitRoutingInfo(), ExecInitUpdateProjection(), FindReplTupleInLocalRel(), get_actual_variable_range(), heapam_index_build_range_scan(), heapam_relation_copy_for_cluster(), IndexCheckExclusion(), RelationFindReplTupleSeq(), systable_beginscan(), systable_beginscan_ordered(), table_index_fetch_tuple_check(), validateDomainConstraint(), and validateForeignKeyConstraint().

◆ table_tuple_complete_speculative()

static void table_tuple_complete_speculative ( Relation  rel,
TupleTableSlot slot,
uint32  specToken,
bool  succeeded 
)
inlinestatic

Definition at line 1406 of file tableam.h.

1408 {
1409  rel->rd_tableam->tuple_complete_speculative(rel, slot, specToken,
1410  succeeded);
1411 }

References RelationData::rd_tableam, and TableAmRoutine::tuple_complete_speculative.

Referenced by ExecInsert().

◆ table_tuple_delete()

static TM_Result table_tuple_delete ( Relation  rel,
ItemPointer  tid,
CommandId  cid,
Snapshot  snapshot,
Snapshot  crosscheck,
bool  wait,
TM_FailureData tmfd,
bool  changingPart 
)
inlinestatic

Definition at line 1462 of file tableam.h.

1465 {
1466  return rel->rd_tableam->tuple_delete(rel, tid, cid,
1467  snapshot, crosscheck,
1468  wait, tmfd, changingPart);
1469 }

References RelationData::rd_tableam, and TableAmRoutine::tuple_delete.

Referenced by ExecDeleteAct(), and simple_table_tuple_delete().

◆ table_tuple_fetch_row_version()

static bool table_tuple_fetch_row_version ( Relation  rel,
ItemPointer  tid,
Snapshot  snapshot,
TupleTableSlot slot 
)
inlinestatic

Definition at line 1259 of file tableam.h.

1263 {
1264  /*
1265  * We don't expect direct calls to table_tuple_fetch_row_version with
1266  * valid CheckXidAlive for catalog or regular tables. See detailed
1267  * comments in xact.c where these variables are declared.
1268  */
1270  elog(ERROR, "unexpected table_tuple_fetch_row_version call during logical decoding");
1271 
1272  return rel->rd_tableam->tuple_fetch_row_version(rel, tid, snapshot, slot);
1273 }

References bsysscan, CheckXidAlive, elog, ERROR, RelationData::rd_tableam, TransactionIdIsValid, TableAmRoutine::tuple_fetch_row_version, and unlikely.

Referenced by AfterTriggerExecute(), EvalPlanQualFetchRowMark(), ExecCheckTIDVisible(), ExecCrossPartitionUpdate(), ExecDelete(), ExecMergeMatched(), ExecModifyTable(), ExecUpdate(), GetTupleForTrigger(), and TidNext().

◆ table_tuple_get_latest_tid()

void table_tuple_get_latest_tid ( TableScanDesc  scan,
ItemPointer  tid 
)

Definition at line 246 of file tableam.c.

247 {
248  Relation rel = scan->rs_rd;
249  const TableAmRoutine *tableam = rel->rd_tableam;
250 
251  /*
252  * We don't expect direct calls to table_tuple_get_latest_tid with valid
253  * CheckXidAlive for catalog or regular tables. See detailed comments in
254  * xact.c where these variables are declared.
255  */
257  elog(ERROR, "unexpected table_tuple_get_latest_tid call during logical decoding");
258 
259  /*
260  * Since this can be called with user-supplied TID, don't trust the input
261  * too much.
262  */
263  if (!tableam->tuple_tid_valid(scan, tid))
264  ereport(ERROR,
265  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
266  errmsg("tid (%u, %u) is not valid for relation \"%s\"",
269  RelationGetRelationName(rel))));
270 
271  tableam->tuple_get_latest_tid(scan, tid);
272 }
#define ItemPointerGetBlockNumberNoCheck(pointer)
Definition: itemptr.h:89
#define ItemPointerGetOffsetNumberNoCheck(pointer)
Definition: itemptr.h:108
#define RelationGetRelationName(relation)
Definition: rel.h:523

References bsysscan, CheckXidAlive, elog, ereport, errcode(), errmsg(), ERROR, ItemPointerGetBlockNumberNoCheck, ItemPointerGetOffsetNumberNoCheck, RelationData::rd_tableam, RelationGetRelationName, TableScanDescData::rs_rd, TransactionIdIsValid, TableAmRoutine::tuple_get_latest_tid, TableAmRoutine::tuple_tid_valid, and unlikely.

Referenced by currtid_internal(), and TidNext().

◆ table_tuple_insert()

static void table_tuple_insert ( Relation  rel,
TupleTableSlot slot,
CommandId  cid,
int  options,
struct BulkInsertStateData bistate 
)
inlinestatic

Definition at line 1373 of file tableam.h.

1375 {
1376  rel->rd_tableam->tuple_insert(rel, slot, cid, options,
1377  bistate);
1378 }

References RelationData::rd_tableam, and TableAmRoutine::tuple_insert.

Referenced by ATRewriteTable(), CopyFrom(), ExecInsert(), intorel_receive(), simple_table_tuple_insert(), and transientrel_receive().

◆ table_tuple_insert_speculative()

static void table_tuple_insert_speculative ( Relation  rel,
TupleTableSlot slot,
CommandId  cid,
int  options,
struct BulkInsertStateData bistate,
uint32  specToken 
)
inlinestatic

Definition at line 1392 of file tableam.h.

1396 {
1397  rel->rd_tableam->tuple_insert_speculative(rel, slot, cid, options,
1398  bistate, specToken);
1399 }

References RelationData::rd_tableam, and TableAmRoutine::tuple_insert_speculative.

Referenced by ExecInsert().

◆ table_tuple_lock()

static TM_Result table_tuple_lock ( Relation  rel,
ItemPointer  tid,
Snapshot  snapshot,
TupleTableSlot slot,
CommandId  cid,
LockTupleMode  mode,
LockWaitPolicy  wait_policy,
uint8  flags,
TM_FailureData tmfd 
)
inlinestatic

Definition at line 1551 of file tableam.h.

1555 {
1556  return rel->rd_tableam->tuple_lock(rel, tid, snapshot, slot,
1557  cid, mode, wait_policy,
1558  flags, tmfd);
1559 }
static PgChecksumMode mode
Definition: pg_checksums.c:65

References mode, RelationData::rd_tableam, and TableAmRoutine::tuple_lock.

Referenced by ExecDelete(), ExecLockRows(), ExecMergeMatched(), ExecOnConflictUpdate(), ExecUpdate(), GetTupleForTrigger(), RelationFindReplTupleByIndex(), and RelationFindReplTupleSeq().

◆ table_tuple_satisfies_snapshot()

static bool table_tuple_satisfies_snapshot ( Relation  rel,
TupleTableSlot slot,
Snapshot  snapshot 
)
inlinestatic

Definition at line 1306 of file tableam.h.

1308 {
1309  return rel->rd_tableam->tuple_satisfies_snapshot(rel, slot, snapshot);
1310 }

References RelationData::rd_tableam, and TableAmRoutine::tuple_satisfies_snapshot.

Referenced by ExecCheckTupleVisible(), RI_FKey_check(), and systable_recheck_tuple().

◆ table_tuple_tid_valid()

static bool table_tuple_tid_valid ( TableScanDesc  scan,
ItemPointer  tid 
)
inlinestatic

Definition at line 1285 of file tableam.h.

1286 {
1287  return scan->rs_rd->rd_tableam->tuple_tid_valid(scan, tid);
1288 }

References RelationData::rd_tableam, TableScanDescData::rs_rd, and TableAmRoutine::tuple_tid_valid.

Referenced by TidListEval().

◆ table_tuple_update()

static TM_Result table_tuple_update ( Relation  rel,
ItemPointer  otid,
TupleTableSlot slot,
CommandId  cid,
Snapshot  snapshot,
Snapshot  crosscheck,
bool  wait,
TM_FailureData tmfd,
LockTupleMode lockmode,
bool update_indexes 
)
inlinestatic

Definition at line 1506 of file tableam.h.

1510 {
1511  return rel->rd_tableam->tuple_update(rel, otid, slot,
1512  cid, snapshot, crosscheck,
1513  wait, tmfd,
1514  lockmode, update_indexes);
1515 }

References RelationData::rd_tableam, and TableAmRoutine::tuple_update.

Referenced by ExecUpdateAct(), and simple_table_tuple_update().

Variable Documentation

◆ default_table_access_method

PGDLLIMPORT char* default_table_access_method
extern

Definition at line 48 of file tableam.c.

Referenced by DefineRelation().

◆ synchronize_seqscans

PGDLLIMPORT bool synchronize_seqscans
extern

Definition at line 49 of file tableam.c.

Referenced by initscan(), and table_block_parallelscan_initialize().