356#define HEAP_MIN_FILLFACTOR 10
357#define HEAP_DEFAULT_FILLFACTOR 100
363#define RelationGetToastTupleTarget(relation, defaulttarg) \
364 ((relation)->rd_options ? \
365 ((StdRdOptions *) (relation)->rd_options)->toast_tuple_target : (defaulttarg))
371#define RelationGetFillFactor(relation, defaultff) \
372 ((relation)->rd_options ? \
373 ((StdRdOptions *) (relation)->rd_options)->fillfactor : (defaultff))
379#define RelationGetTargetPageUsage(relation, defaultff) \
380 (BLCKSZ * RelationGetFillFactor(relation, defaultff) / 100)
386#define RelationGetTargetPageFreeSpace(relation, defaultff) \
387 (BLCKSZ * (100 - RelationGetFillFactor(relation, defaultff)) / 100)
394#define RelationIsUsedAsCatalogTable(relation) \
395 ((relation)->rd_options && \
396 ((relation)->rd_rel->relkind == RELKIND_RELATION || \
397 (relation)->rd_rel->relkind == RELKIND_MATVIEW) ? \
398 ((StdRdOptions *) (relation)->rd_options)->user_catalog_table : false)
405#define RelationGetParallelWorkers(relation, defaultpw) \
406 ((relation)->rd_options ? \
407 ((StdRdOptions *) (relation)->rd_options)->parallel_workers : (defaultpw))
434#define RelationIsSecurityView(relation) \
435 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
436 (relation)->rd_options ? \
437 ((ViewOptions *) (relation)->rd_options)->security_barrier : false)
444#define RelationHasSecurityInvoker(relation) \
445 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
446 (relation)->rd_options ? \
447 ((ViewOptions *) (relation)->rd_options)->security_invoker : false)
454#define RelationHasCheckOption(relation) \
455 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
456 (relation)->rd_options && \
457 ((ViewOptions *) (relation)->rd_options)->check_option != \
458 VIEW_OPTION_CHECK_OPTION_NOT_SET)
465#define RelationHasLocalCheckOption(relation) \
466 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
467 (relation)->rd_options && \
468 ((ViewOptions *) (relation)->rd_options)->check_option == \
469 VIEW_OPTION_CHECK_OPTION_LOCAL)
476#define RelationHasCascadedCheckOption(relation) \
477 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
478 (relation)->rd_options && \
479 ((ViewOptions *) (relation)->rd_options)->check_option == \
480 VIEW_OPTION_CHECK_OPTION_CASCADED)
486#define RelationIsValid(relation) PointerIsValid(relation)
488#define InvalidRelation ((Relation) NULL)
497#define RelationHasReferenceCountZero(relation) \
498 ((bool)((relation)->rd_refcnt == 0))
507#define RelationGetForm(relation) ((relation)->rd_rel)
513#define RelationGetRelid(relation) ((relation)->rd_id)
519#define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts)
525#define IndexRelationGetNumberOfAttributes(relation) \
526 ((relation)->rd_index->indnatts)
532#define IndexRelationGetNumberOfKeyAttributes(relation) \
533 ((relation)->rd_index->indnkeyatts)
539#define RelationGetDescr(relation) ((relation)->rd_att)
547#define RelationGetRelationName(relation) \
548 (NameStr((relation)->rd_rel->relname))
554#define RelationGetNamespace(relation) \
555 ((relation)->rd_rel->relnamespace)
562#define RelationIsMapped(relation) \
563 (RELKIND_HAS_STORAGE((relation)->rd_rel->relkind) && \
564 ((relation)->rd_rel->relfilenode == InvalidRelFileNumber))
609#define RelationGetTargetBlock(relation) \
610 ( (relation)->rd_smgr != NULL ? (relation)->rd_smgr->smgr_targblock : InvalidBlockNumber )
616#define RelationSetTargetBlock(relation, targblock) \
618 RelationGetSmgr(relation)->smgr_targblock = (targblock); \
625#define RelationIsPermanent(relation) \
626 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
636#define RelationNeedsWAL(relation) \
637 (RelationIsPermanent(relation) && (XLogIsNeeded() || \
638 (relation->rd_createSubid == InvalidSubTransactionId && \
639 relation->rd_firstRelfilelocatorSubid == InvalidSubTransactionId)))
645#define RelationUsesLocalBuffers(relation) \
646 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP)
656#define RELATION_IS_LOCAL(relation) \
657 ((relation)->rd_islocaltemp || \
658 (relation)->rd_createSubid != InvalidSubTransactionId)
666#define RELATION_IS_OTHER_TEMP(relation) \
667 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP && \
668 !(relation)->rd_islocaltemp)
677#define RelationIsScannable(relation) ((relation)->rd_rel->relispopulated)
685#define RelationIsPopulated(relation) ((relation)->rd_rel->relispopulated)
692#define RelationIsAccessibleInLogicalDecoding(relation) \
693 (XLogLogicalInfoActive() && \
694 RelationNeedsWAL(relation) && \
695 (IsCatalogRelation(relation) || RelationIsUsedAsCatalogTable(relation)))
709#define RelationIsLogicallyLogged(relation) \
710 (XLogLogicalInfoActive() && \
711 RelationNeedsWAL(relation) && \
712 (relation)->rd_rel->relkind != RELKIND_FOREIGN_TABLE && \
713 !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