359#define HEAP_MIN_FILLFACTOR 10
360#define HEAP_DEFAULT_FILLFACTOR 100
366#define RelationGetToastTupleTarget(relation, defaulttarg) \
367 ((relation)->rd_options ? \
368 ((StdRdOptions *) (relation)->rd_options)->toast_tuple_target : (defaulttarg))
374#define RelationGetFillFactor(relation, defaultff) \
375 ((relation)->rd_options ? \
376 ((StdRdOptions *) (relation)->rd_options)->fillfactor : (defaultff))
382#define RelationGetTargetPageUsage(relation, defaultff) \
383 (BLCKSZ * RelationGetFillFactor(relation, defaultff) / 100)
389#define RelationGetTargetPageFreeSpace(relation, defaultff) \
390 (BLCKSZ * (100 - RelationGetFillFactor(relation, defaultff)) / 100)
397#define RelationIsUsedAsCatalogTable(relation) \
398 ((relation)->rd_options && \
399 ((relation)->rd_rel->relkind == RELKIND_RELATION || \
400 (relation)->rd_rel->relkind == RELKIND_MATVIEW) ? \
401 ((StdRdOptions *) (relation)->rd_options)->user_catalog_table : false)
408#define RelationGetParallelWorkers(relation, defaultpw) \
409 ((relation)->rd_options ? \
410 ((StdRdOptions *) (relation)->rd_options)->parallel_workers : (defaultpw))
437#define RelationIsSecurityView(relation) \
438 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
439 (relation)->rd_options ? \
440 ((ViewOptions *) (relation)->rd_options)->security_barrier : false)
447#define RelationHasSecurityInvoker(relation) \
448 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
449 (relation)->rd_options ? \
450 ((ViewOptions *) (relation)->rd_options)->security_invoker : false)
457#define RelationHasCheckOption(relation) \
458 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
459 (relation)->rd_options && \
460 ((ViewOptions *) (relation)->rd_options)->check_option != \
461 VIEW_OPTION_CHECK_OPTION_NOT_SET)
468#define RelationHasLocalCheckOption(relation) \
469 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
470 (relation)->rd_options && \
471 ((ViewOptions *) (relation)->rd_options)->check_option == \
472 VIEW_OPTION_CHECK_OPTION_LOCAL)
479#define RelationHasCascadedCheckOption(relation) \
480 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
481 (relation)->rd_options && \
482 ((ViewOptions *) (relation)->rd_options)->check_option == \
483 VIEW_OPTION_CHECK_OPTION_CASCADED)
489#define RelationIsValid(relation) PointerIsValid(relation)
491#define InvalidRelation ((Relation) NULL)
500#define RelationHasReferenceCountZero(relation) \
501 ((bool)((relation)->rd_refcnt == 0))
510#define RelationGetForm(relation) ((relation)->rd_rel)
516#define RelationGetRelid(relation) ((relation)->rd_id)
522#define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts)
528#define IndexRelationGetNumberOfAttributes(relation) \
529 ((relation)->rd_index->indnatts)
535#define IndexRelationGetNumberOfKeyAttributes(relation) \
536 ((relation)->rd_index->indnkeyatts)
542#define RelationGetDescr(relation) ((relation)->rd_att)
550#define RelationGetRelationName(relation) \
551 (NameStr((relation)->rd_rel->relname))
557#define RelationGetNamespace(relation) \
558 ((relation)->rd_rel->relnamespace)
565#define RelationIsMapped(relation) \
566 (RELKIND_HAS_STORAGE((relation)->rd_rel->relkind) && \
567 ((relation)->rd_rel->relfilenode == InvalidRelFileNumber))
612#define RelationGetTargetBlock(relation) \
613 ( (relation)->rd_smgr != NULL ? (relation)->rd_smgr->smgr_targblock : InvalidBlockNumber )
619#define RelationSetTargetBlock(relation, targblock) \
621 RelationGetSmgr(relation)->smgr_targblock = (targblock); \
628#define RelationIsPermanent(relation) \
629 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
639#define RelationNeedsWAL(relation) \
640 (RelationIsPermanent(relation) && (XLogIsNeeded() || \
641 (relation->rd_createSubid == InvalidSubTransactionId && \
642 relation->rd_firstRelfilelocatorSubid == InvalidSubTransactionId)))
648#define RelationUsesLocalBuffers(relation) \
649 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP)
659#define RELATION_IS_LOCAL(relation) \
660 ((relation)->rd_islocaltemp || \
661 (relation)->rd_createSubid != InvalidSubTransactionId)
669#define RELATION_IS_OTHER_TEMP(relation) \
670 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP && \
671 !(relation)->rd_islocaltemp)
680#define RelationIsScannable(relation) ((relation)->rd_rel->relispopulated)
688#define RelationIsPopulated(relation) ((relation)->rd_rel->relispopulated)
695#define RelationIsAccessibleInLogicalDecoding(relation) \
696 (XLogLogicalInfoActive() && \
697 RelationNeedsWAL(relation) && \
698 (IsCatalogRelation(relation) || RelationIsUsedAsCatalogTable(relation)))
712#define RelationIsLogicallyLogged(relation) \
713 (XLogLogicalInfoActive() && \
714 RelationNeedsWAL(relation) && \
715 (relation)->rd_rel->relkind != RELKIND_FOREIGN_TABLE && \
716 !IsCatalogRelation(relation))
FormData_pg_class * Form_pg_class
FormData_pg_index * Form_pg_index
struct LockRelId LockRelId
void RelationDecrementReferenceCount(Relation rel)
@ VIEW_OPTION_CHECK_OPTION_NOT_SET
@ VIEW_OPTION_CHECK_OPTION_LOCAL
@ VIEW_OPTION_CHECK_OPTION_CASCADED
struct ForeignKeyCacheInfo ForeignKeyCacheInfo
static SMgrRelation RelationGetSmgr(Relation rel)
void RelationIncrementReferenceCount(Relation rel)
struct StdRdOptions StdRdOptions
struct ViewOptions ViewOptions
struct LockInfoData LockInfoData
struct AutoVacOpts AutoVacOpts
struct RelationData RelationData
static void RelationCloseSmgr(Relation relation)
@ STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO
@ STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF
@ STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON
SMgrRelation smgropen(RelFileLocator rlocator, ProcNumber backend)
void smgrpin(SMgrRelation reln)
void smgrunpin(SMgrRelation reln)
void smgrclose(SMgrRelation reln)
int multixact_freeze_max_age
float8 vacuum_scale_factor
float8 vacuum_ins_scale_factor
int multixact_freeze_table_age
int multixact_freeze_min_age
float8 analyze_scale_factor
AttrNumber conkey[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys))
AttrNumber confkey[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys))
Oid conpfeqop[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys))
pg_node_attr(no_equal, no_read, no_query_jumble) NodeTag type
MemoryContext rd_partkeycxt
const struct TableAmRoutine * rd_tableam
TransactionId rd_partdesc_nodetached_xmin
struct IndexAmRoutine * rd_indam
SubTransactionId rd_firstRelfilelocatorSubid
struct RowSecurityDesc * rd_rsdesc
PartitionDesc rd_partdesc
RegProcedure * rd_support
PartitionDesc rd_partdesc_nodetached
PublicationDesc * rd_pubdesc
struct FdwRoutine * rd_fdwroutine
struct HeapTupleData * rd_indextuple
MemoryContext rd_partcheckcxt
Bitmapset * rd_hotblockingattr
SubTransactionId rd_newRelfilelocatorSubid
SubTransactionId rd_createSubid
MemoryContext rd_indexcxt
RelFileLocator rd_locator
struct FmgrInfo * rd_supportinfo
SubTransactionId rd_droppedSubid
MemoryContext rd_rulescxt
Bitmapset * rd_summarizedattr
struct PgStat_TableStatus * pgstat_info
double vacuum_max_eager_freeze_failure_rate
StdRdOptIndexCleanup vacuum_index_cleanup
ViewOptCheckOption check_option