348 #define HEAP_MIN_FILLFACTOR 10
349 #define HEAP_DEFAULT_FILLFACTOR 100
355 #define RelationGetToastTupleTarget(relation, defaulttarg) \
356 ((relation)->rd_options ? \
357 ((StdRdOptions *) (relation)->rd_options)->toast_tuple_target : (defaulttarg))
363 #define RelationGetFillFactor(relation, defaultff) \
364 ((relation)->rd_options ? \
365 ((StdRdOptions *) (relation)->rd_options)->fillfactor : (defaultff))
371 #define RelationGetTargetPageUsage(relation, defaultff) \
372 (BLCKSZ * RelationGetFillFactor(relation, defaultff) / 100)
378 #define RelationGetTargetPageFreeSpace(relation, defaultff) \
379 (BLCKSZ * (100 - RelationGetFillFactor(relation, defaultff)) / 100)
386 #define RelationIsUsedAsCatalogTable(relation) \
387 ((relation)->rd_options && \
388 ((relation)->rd_rel->relkind == RELKIND_RELATION || \
389 (relation)->rd_rel->relkind == RELKIND_MATVIEW) ? \
390 ((StdRdOptions *) (relation)->rd_options)->user_catalog_table : false)
397 #define RelationGetParallelWorkers(relation, defaultpw) \
398 ((relation)->rd_options ? \
399 ((StdRdOptions *) (relation)->rd_options)->parallel_workers : (defaultpw))
426 #define RelationIsSecurityView(relation) \
427 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
428 (relation)->rd_options ? \
429 ((ViewOptions *) (relation)->rd_options)->security_barrier : false)
436 #define RelationHasSecurityInvoker(relation) \
437 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
438 (relation)->rd_options ? \
439 ((ViewOptions *) (relation)->rd_options)->security_invoker : false)
446 #define RelationHasCheckOption(relation) \
447 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
448 (relation)->rd_options && \
449 ((ViewOptions *) (relation)->rd_options)->check_option != \
450 VIEW_OPTION_CHECK_OPTION_NOT_SET)
457 #define RelationHasLocalCheckOption(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_LOCAL)
468 #define RelationHasCascadedCheckOption(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_CASCADED)
478 #define RelationIsValid(relation) PointerIsValid(relation)
480 #define InvalidRelation ((Relation) NULL)
489 #define RelationHasReferenceCountZero(relation) \
490 ((bool)((relation)->rd_refcnt == 0))
499 #define RelationGetForm(relation) ((relation)->rd_rel)
505 #define RelationGetRelid(relation) ((relation)->rd_id)
511 #define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts)
517 #define IndexRelationGetNumberOfAttributes(relation) \
518 ((relation)->rd_index->indnatts)
524 #define IndexRelationGetNumberOfKeyAttributes(relation) \
525 ((relation)->rd_index->indnkeyatts)
531 #define RelationGetDescr(relation) ((relation)->rd_att)
539 #define RelationGetRelationName(relation) \
540 (NameStr((relation)->rd_rel->relname))
546 #define RelationGetNamespace(relation) \
547 ((relation)->rd_rel->relnamespace)
554 #define RelationIsMapped(relation) \
555 (RELKIND_HAS_STORAGE((relation)->rd_rel->relkind) && \
556 ((relation)->rd_rel->relfilenode == InvalidRelFileNumber))
601 #define RelationGetTargetBlock(relation) \
602 ( (relation)->rd_smgr != NULL ? (relation)->rd_smgr->smgr_targblock : InvalidBlockNumber )
608 #define RelationSetTargetBlock(relation, targblock) \
610 RelationGetSmgr(relation)->smgr_targblock = (targblock); \
617 #define RelationIsPermanent(relation) \
618 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
628 #define RelationNeedsWAL(relation) \
629 (RelationIsPermanent(relation) && (XLogIsNeeded() || \
630 (relation->rd_createSubid == InvalidSubTransactionId && \
631 relation->rd_firstRelfilelocatorSubid == InvalidSubTransactionId)))
637 #define RelationUsesLocalBuffers(relation) \
638 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP)
648 #define RELATION_IS_LOCAL(relation) \
649 ((relation)->rd_islocaltemp || \
650 (relation)->rd_createSubid != InvalidSubTransactionId)
658 #define RELATION_IS_OTHER_TEMP(relation) \
659 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP && \
660 !(relation)->rd_islocaltemp)
669 #define RelationIsScannable(relation) ((relation)->rd_rel->relispopulated)
677 #define RelationIsPopulated(relation) ((relation)->rd_rel->relispopulated)
684 #define RelationIsAccessibleInLogicalDecoding(relation) \
685 (XLogLogicalInfoActive() && \
686 RelationNeedsWAL(relation) && \
687 (IsCatalogRelation(relation) || RelationIsUsedAsCatalogTable(relation)))
701 #define RelationIsLogicallyLogged(relation) \
702 (XLogLogicalInfoActive() && \
703 RelationNeedsWAL(relation) && \
704 (relation)->rd_rel->relkind != RELKIND_FOREIGN_TABLE && \
705 !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 confkey[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys))
Oid conpfeqop[INDEX_MAX_KEYS] pg_node_attr(array_size(nkeys))
AttrNumber conkey[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
StdRdOptIndexCleanup vacuum_index_cleanup
ViewOptCheckOption check_option