360#define HEAP_MIN_FILLFACTOR 10
361#define HEAP_DEFAULT_FILLFACTOR 100
367#define RelationGetToastTupleTarget(relation, defaulttarg) \
368 ((relation)->rd_options ? \
369 ((StdRdOptions *) (relation)->rd_options)->toast_tuple_target : (defaulttarg))
375#define RelationGetFillFactor(relation, defaultff) \
376 ((relation)->rd_options ? \
377 ((StdRdOptions *) (relation)->rd_options)->fillfactor : (defaultff))
383#define RelationGetTargetPageUsage(relation, defaultff) \
384 (BLCKSZ * RelationGetFillFactor(relation, defaultff) / 100)
390#define RelationGetTargetPageFreeSpace(relation, defaultff) \
391 (BLCKSZ * (100 - RelationGetFillFactor(relation, defaultff)) / 100)
398#define RelationIsUsedAsCatalogTable(relation) \
399 ((relation)->rd_options && \
400 ((relation)->rd_rel->relkind == RELKIND_RELATION || \
401 (relation)->rd_rel->relkind == RELKIND_MATVIEW) ? \
402 ((StdRdOptions *) (relation)->rd_options)->user_catalog_table : false)
409#define RelationGetParallelWorkers(relation, defaultpw) \
410 ((relation)->rd_options ? \
411 ((StdRdOptions *) (relation)->rd_options)->parallel_workers : (defaultpw))
438#define RelationIsSecurityView(relation) \
439 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
440 (relation)->rd_options ? \
441 ((ViewOptions *) (relation)->rd_options)->security_barrier : false)
448#define RelationHasSecurityInvoker(relation) \
449 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
450 (relation)->rd_options ? \
451 ((ViewOptions *) (relation)->rd_options)->security_invoker : false)
458#define RelationHasCheckOption(relation) \
459 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
460 (relation)->rd_options && \
461 ((ViewOptions *) (relation)->rd_options)->check_option != \
462 VIEW_OPTION_CHECK_OPTION_NOT_SET)
469#define RelationHasLocalCheckOption(relation) \
470 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
471 (relation)->rd_options && \
472 ((ViewOptions *) (relation)->rd_options)->check_option == \
473 VIEW_OPTION_CHECK_OPTION_LOCAL)
480#define RelationHasCascadedCheckOption(relation) \
481 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
482 (relation)->rd_options && \
483 ((ViewOptions *) (relation)->rd_options)->check_option == \
484 VIEW_OPTION_CHECK_OPTION_CASCADED)
490#define RelationIsValid(relation) ((relation) != NULL)
499#define RelationHasReferenceCountZero(relation) \
500 ((bool)((relation)->rd_refcnt == 0))
509#define RelationGetForm(relation) ((relation)->rd_rel)
515#define RelationGetRelid(relation) ((relation)->rd_id)
521#define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts)
527#define IndexRelationGetNumberOfAttributes(relation) \
528 ((relation)->rd_index->indnatts)
534#define IndexRelationGetNumberOfKeyAttributes(relation) \
535 ((relation)->rd_index->indnkeyatts)
541#define RelationGetDescr(relation) ((relation)->rd_att)
549#define RelationGetRelationName(relation) \
550 (NameStr((relation)->rd_rel->relname))
556#define RelationGetNamespace(relation) \
557 ((relation)->rd_rel->relnamespace)
564#define RelationIsMapped(relation) \
565 (RELKIND_HAS_STORAGE((relation)->rd_rel->relkind) && \
566 ((relation)->rd_rel->relfilenode == InvalidRelFileNumber))
611#define RelationGetTargetBlock(relation) \
612 ( (relation)->rd_smgr != NULL ? (relation)->rd_smgr->smgr_targblock : InvalidBlockNumber )
618#define RelationSetTargetBlock(relation, targblock) \
620 RelationGetSmgr(relation)->smgr_targblock = (targblock); \
627#define RelationIsPermanent(relation) \
628 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
638#define RelationNeedsWAL(relation) \
639 (RelationIsPermanent(relation) && (XLogIsNeeded() || \
640 (relation->rd_createSubid == InvalidSubTransactionId && \
641 relation->rd_firstRelfilelocatorSubid == InvalidSubTransactionId)))
647#define RelationUsesLocalBuffers(relation) \
648 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP)
658#define RELATION_IS_LOCAL(relation) \
659 ((relation)->rd_islocaltemp || \
660 (relation)->rd_createSubid != InvalidSubTransactionId)
668#define RELATION_IS_OTHER_TEMP(relation) \
669 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP && \
670 !(relation)->rd_islocaltemp)
679#define RelationIsScannable(relation) ((relation)->rd_rel->relispopulated)
687#define RelationIsPopulated(relation) ((relation)->rd_rel->relispopulated)
694#define RelationIsAccessibleInLogicalDecoding(relation) \
695 (XLogLogicalInfoActive() && \
696 RelationNeedsWAL(relation) && \
697 (IsCatalogRelation(relation) || RelationIsUsedAsCatalogTable(relation)))
711#define RelationIsLogicallyLogged(relation) \
712 (XLogLogicalInfoActive() && \
713 RelationNeedsWAL(relation) && \
714 (relation)->rd_rel->relkind != RELKIND_FOREIGN_TABLE && \
715 !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 log_vacuum_min_duration
int multixact_freeze_min_age
int log_analyze_min_duration
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