29 #define DEFAULT_TABLE_ACCESS_METHOD "heap"
259 #define TABLE_INSERT_SKIP_FSM 0x0002
260 #define TABLE_INSERT_FROZEN 0x0004
261 #define TABLE_INSERT_NO_LOGICAL 0x0008
265 #define TUPLE_LOCK_FLAG_LOCK_UPDATE_IN_PROGRESS (1 << 0)
267 #define TUPLE_LOCK_FLAG_FIND_LAST_VERSION (1 << 1)
344 bool set_params,
bool allow_strat,
345 bool allow_sync,
bool allow_pagemode);
460 bool *call_again,
bool *all_dead);
635 double *tups_vacuumed,
636 double *tups_recently_dead);
701 void *callback_state,
823 uint64 *exact_pages);
938 bool allow_strat,
bool allow_sync)
968 result->
st.
bitmap.rs_shared_iterator = NULL;
969 result->
st.
bitmap.rs_iterator = NULL;
983 bool allow_strat,
bool allow_sync,
1053 bool allow_strat,
bool allow_sync,
bool allow_pagemode)
1056 allow_strat, allow_sync,
1078 elog(
ERROR,
"unexpected table_scan_getnextslot call during logical decoding");
1254 bool *call_again,
bool *all_dead)
1262 elog(
ERROR,
"unexpected table_index_fetch_tuple call during logical decoding");
1308 elog(
ERROR,
"unexpected table_tuple_fetch_row_version call during logical decoding");
1436 bistate, specToken);
1445 uint32 specToken,
bool succeeded)
1505 snapshot, crosscheck,
1506 wait, tmfd, changingPart);
1550 cid, snapshot, crosscheck,
1552 lockmode, update_indexes);
1595 cid,
mode, wait_policy,
1637 persistence, freezeXid,
1694 double *tups_vacuumed,
1695 double *tups_recently_dead)
1698 use_sort, OldestXmin,
1699 xid_cutoff, multi_cutoff,
1700 num_tuples, tups_vacuumed,
1701 tups_recently_dead);
1748 double *liverows,
double *deadrows,
1783 static inline double
1790 void *callback_state,
1816 static inline double
1826 void *callback_state,
1876 static inline uint64
1931 sliceoffset, slicelength,
1983 uint64 *lossy_pages,
1984 uint64 *exact_pages)
1992 elog(
ERROR,
"unexpected table_scan_bitmap_next_block call during logical decoding");
2018 elog(
ERROR,
"unexpected table_scan_bitmap_next_tuple call during logical decoding");
2043 elog(
ERROR,
"unexpected table_scan_sample_next_block call during logical decoding");
2066 elog(
ERROR,
"unexpected table_scan_sample_next_tuple call during logical decoding");
2114 Size overhead_bytes_per_tuple,
2115 Size usable_bytes_per_page);
#define InvalidBlockNumber
static Datum values[MAXATTR]
#define Assert(condition)
TransactionId MultiXactId
static PgChecksumMode mode
#define RelationGetRelid(relation)
struct TableScanDescData * TableScanDesc
const struct TableAmRoutine * rd_tableam
Size(* parallelscan_initialize)(Relation rel, ParallelTableScanDesc pscan)
void(* relation_copy_data)(Relation rel, const RelFileLocator *newrlocator)
bool(* scan_sample_next_tuple)(TableScanDesc scan, struct SampleScanState *scanstate, TupleTableSlot *slot)
void(* index_fetch_reset)(struct IndexFetchTableData *data)
void(* tuple_complete_speculative)(Relation rel, TupleTableSlot *slot, uint32 specToken, bool succeeded)
void(* parallelscan_reinitialize)(Relation rel, ParallelTableScanDesc pscan)
void(* tuple_get_latest_tid)(TableScanDesc scan, ItemPointer tid)
struct IndexFetchTableData *(* index_fetch_begin)(Relation rel)
void(* 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)
bool(* scan_getnextslot_tidrange)(TableScanDesc scan, ScanDirection direction, TupleTableSlot *slot)
void(* relation_estimate_size)(Relation rel, int32 *attr_widths, BlockNumber *pages, double *tuples, double *allvisfrac)
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)
TableScanDesc(* scan_begin)(Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key, ParallelTableScanDesc pscan, uint32 flags)
bool(* relation_needs_toast_table)(Relation rel)
bool(* scan_bitmap_next_block)(TableScanDesc scan, BlockNumber *blockno, bool *recheck, uint64 *lossy_pages, uint64 *exact_pages)
bool(* tuple_tid_valid)(TableScanDesc scan, ItemPointer tid)
void(* multi_insert)(Relation rel, TupleTableSlot **slots, int nslots, CommandId cid, int options, struct BulkInsertStateData *bistate)
bool(* scan_bitmap_next_tuple)(TableScanDesc scan, TupleTableSlot *slot)
void(* scan_end)(TableScanDesc scan)
uint64(* relation_size)(Relation rel, ForkNumber forkNumber)
TM_Result(* tuple_lock)(Relation rel, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, CommandId cid, LockTupleMode mode, LockWaitPolicy wait_policy, uint8 flags, TM_FailureData *tmfd)
bool(* scan_sample_next_block)(TableScanDesc scan, struct SampleScanState *scanstate)
void(* relation_nontransactional_truncate)(Relation rel)
TM_Result(* tuple_update)(Relation rel, ItemPointer otid, TupleTableSlot *slot, CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, LockTupleMode *lockmode, TU_UpdateIndexes *update_indexes)
void(* tuple_insert)(Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate)
void(* scan_rescan)(TableScanDesc scan, struct ScanKeyData *key, bool set_params, bool allow_strat, bool allow_sync, bool allow_pagemode)
bool(* tuple_fetch_row_version)(Relation rel, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot)
void(* relation_fetch_toast_slice)(Relation toastrel, Oid valueid, int32 attrsize, int32 sliceoffset, int32 slicelength, struct varlena *result)
void(* relation_vacuum)(Relation rel, struct VacuumParams *params, BufferAccessStrategy bstrategy)
Oid(* relation_toast_am)(Relation rel)
bool(* scan_analyze_next_block)(TableScanDesc scan, ReadStream *stream)
Size(* parallelscan_estimate)(Relation rel)
void(* relation_set_new_filelocator)(Relation rel, const RelFileLocator *newrlocator, char persistence, TransactionId *freezeXid, MultiXactId *minmulti)
void(* scan_set_tidrange)(TableScanDesc scan, ItemPointer mintid, ItemPointer maxtid)
void(* finish_bulk_insert)(Relation rel, int options)
bool(* scan_analyze_next_tuple)(TableScanDesc scan, TransactionId OldestXmin, double *liverows, double *deadrows, TupleTableSlot *slot)
TransactionId(* index_delete_tuples)(Relation rel, TM_IndexDeleteOp *delstate)
void(* index_fetch_end)(struct IndexFetchTableData *data)
bool(* index_fetch_tuple)(struct IndexFetchTableData *scan, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, bool *call_again, bool *all_dead)
void(* tuple_insert_speculative)(Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate, uint32 specToken)
TM_Result(* tuple_delete)(Relation rel, ItemPointer tid, CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, bool changingPart)
void(* index_validate_scan)(Relation table_rel, Relation index_rel, struct IndexInfo *index_info, Snapshot snapshot, struct ValidateIndexState *state)
bool(* scan_getnextslot)(TableScanDesc scan, ScanDirection direction, TupleTableSlot *slot)
bool(* tuple_satisfies_snapshot)(Relation rel, TupleTableSlot *slot, Snapshot snapshot)
union TableScanDescData::@48 st
struct TableScanDescData::@48::@49 bitmap
static void table_relation_fetch_toast_slice(Relation toastrel, Oid valueid, int32 attrsize, int32 sliceoffset, int32 slicelength, struct varlena *result)
PGDLLIMPORT char * default_table_access_method
static void table_rescan_tidrange(TableScanDesc sscan, ItemPointer mintid, ItemPointer maxtid)
static TableScanDesc table_beginscan(Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key)
const TupleTableSlotOps * table_slot_callbacks(Relation relation)
static void table_endscan(TableScanDesc scan)
void simple_table_tuple_update(Relation rel, ItemPointer otid, TupleTableSlot *slot, Snapshot snapshot, TU_UpdateIndexes *update_indexes)
static bool table_scan_analyze_next_tuple(TableScanDesc scan, TransactionId OldestXmin, double *liverows, double *deadrows, TupleTableSlot *slot)
bool table_index_fetch_tuple_check(Relation rel, ItemPointer tid, Snapshot snapshot, bool *all_dead)
PGDLLIMPORT bool synchronize_seqscans
Size table_block_parallelscan_initialize(Relation rel, ParallelTableScanDesc pscan)
TableScanDesc table_beginscan_parallel(Relation relation, ParallelTableScanDesc pscan)
struct TM_IndexDelete TM_IndexDelete
static IndexFetchTableData * table_index_fetch_begin(Relation rel)
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_index_fetch_reset(struct IndexFetchTableData *scan)
static uint64 table_relation_size(Relation rel, ForkNumber forkNumber)
static TableScanDesc table_beginscan_sampling(Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key, bool allow_strat, bool allow_sync, bool allow_pagemode)
static void table_rescan(TableScanDesc scan, struct ScanKeyData *key)
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)
void simple_table_tuple_insert(Relation rel, TupleTableSlot *slot)
static bool table_tuple_tid_valid(TableScanDesc scan, ItemPointer tid)
static void table_index_validate_scan(Relation table_rel, Relation index_rel, struct IndexInfo *index_info, Snapshot snapshot, struct ValidateIndexState *state)
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)
void table_block_parallelscan_startblock_init(Relation rel, ParallelBlockTableScanWorker pbscanwork, ParallelBlockTableScanDesc pbscan)
TableScanDesc table_beginscan_catalog(Relation relation, int nkeys, struct ScanKeyData *key)
static bool table_scan_analyze_next_block(TableScanDesc scan, ReadStream *stream)
static bool table_relation_needs_toast_table(Relation rel)
struct TM_IndexStatus TM_IndexStatus
static TableScanDesc table_beginscan_strat(Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key, bool allow_strat, bool allow_sync)
static void table_tuple_complete_speculative(Relation rel, TupleTableSlot *slot, uint32 specToken, bool succeeded)
static TableScanDesc table_beginscan_tidrange(Relation rel, Snapshot snapshot, ItemPointer mintid, ItemPointer maxtid)
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, TU_UpdateIndexes *update_indexes)
static bool table_scan_bitmap_next_tuple(TableScanDesc scan, TupleTableSlot *slot)
static void table_index_fetch_end(struct IndexFetchTableData *scan)
static TableScanDesc table_beginscan_analyze(Relation rel)
static TM_Result table_tuple_delete(Relation rel, ItemPointer tid, CommandId cid, Snapshot snapshot, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, bool changingPart)
void table_tuple_get_latest_tid(TableScanDesc scan, ItemPointer tid)
static bool table_index_fetch_tuple(struct IndexFetchTableData *scan, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, bool *call_again, bool *all_dead)
static void table_rescan_set_params(TableScanDesc scan, struct ScanKeyData *key, bool allow_strat, bool allow_sync, bool allow_pagemode)
static void table_relation_vacuum(Relation rel, struct VacuumParams *params, BufferAccessStrategy bstrategy)
void simple_table_tuple_delete(Relation rel, ItemPointer tid, Snapshot snapshot)
const TableAmRoutine * GetTableAmRoutine(Oid amhandler)
const TableAmRoutine * GetHeapamTableAmRoutine(void)
struct TM_FailureData TM_FailureData
static void table_finish_bulk_insert(Relation rel, int options)
void table_block_parallelscan_reinitialize(Relation rel, ParallelTableScanDesc pscan)
void(* IndexBuildCallback)(Relation index, ItemPointer tid, Datum *values, bool *isnull, bool tupleIsAlive, void *state)
uint64 table_block_relation_size(Relation rel, ForkNumber forkNumber)
static void table_relation_set_new_filelocator(Relation rel, const RelFileLocator *newrlocator, char persistence, TransactionId *freezeXid, MultiXactId *minmulti)
static void table_multi_insert(Relation rel, TupleTableSlot **slots, int nslots, CommandId cid, int options, struct BulkInsertStateData *bistate)
static bool table_scan_getnextslot_tidrange(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
static Oid table_relation_toast_am(Relation rel)
static void table_tuple_insert(Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate)
TupleTableSlot * table_slot_create(Relation relation, List **reglist)
Size table_parallelscan_estimate(Relation rel, Snapshot snapshot)
static bool table_scan_bitmap_next_block(TableScanDesc scan, BlockNumber *blockno, bool *recheck, uint64 *lossy_pages, uint64 *exact_pages)
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 void table_relation_copy_data(Relation rel, const RelFileLocator *newrlocator)
static bool table_scan_sample_next_block(TableScanDesc scan, struct SampleScanState *scanstate)
struct TM_IndexDeleteOp TM_IndexDeleteOp
Size table_block_parallelscan_estimate(Relation rel)
static void table_relation_estimate_size(Relation rel, int32 *attr_widths, BlockNumber *pages, double *tuples, double *allvisfrac)
struct TableAmRoutine TableAmRoutine
static bool table_scan_getnextslot(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
static void table_tuple_insert_speculative(Relation rel, TupleTableSlot *slot, CommandId cid, int options, struct BulkInsertStateData *bistate, uint32 specToken)
static bool table_tuple_satisfies_snapshot(Relation rel, TupleTableSlot *slot, Snapshot snapshot)
static TransactionId table_index_delete_tuples(Relation rel, TM_IndexDeleteOp *delstate)
static bool table_scan_sample_next_tuple(TableScanDesc scan, struct SampleScanState *scanstate, TupleTableSlot *slot)
static void table_relation_nontransactional_truncate(Relation rel)
void table_parallelscan_initialize(Relation rel, ParallelTableScanDesc pscan, Snapshot snapshot)
static TableScanDesc table_beginscan_bm(Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key, bool need_tuple)
static bool table_tuple_fetch_row_version(Relation rel, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot)
static void table_parallelscan_reinitialize(Relation rel, ParallelTableScanDesc pscan)
static TableScanDesc table_beginscan_tid(Relation rel, Snapshot snapshot)
BlockNumber table_block_parallelscan_nextpage(Relation rel, ParallelBlockTableScanWorker pbscanwork, ParallelBlockTableScanDesc pbscan)
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)
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
#define TransactionIdIsValid(xid)
TransactionId CheckXidAlive