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) ((relation) != NULL)
498#define RelationHasReferenceCountZero(relation) \
499 ((bool)((relation)->rd_refcnt == 0))
508#define RelationGetForm(relation) ((relation)->rd_rel)
514#define RelationGetRelid(relation) ((relation)->rd_id)
520#define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts)
526#define IndexRelationGetNumberOfAttributes(relation) \
527 ((relation)->rd_index->indnatts)
533#define IndexRelationGetNumberOfKeyAttributes(relation) \
534 ((relation)->rd_index->indnkeyatts)
540#define RelationGetDescr(relation) ((relation)->rd_att)
548#define RelationGetRelationName(relation) \
549 (NameStr((relation)->rd_rel->relname))
555#define RelationGetNamespace(relation) \
556 ((relation)->rd_rel->relnamespace)
563#define RelationIsMapped(relation) \
564 (RELKIND_HAS_STORAGE((relation)->rd_rel->relkind) && \
565 ((relation)->rd_rel->relfilenode == InvalidRelFileNumber))
610#define RelationGetTargetBlock(relation) \
611 ( (relation)->rd_smgr != NULL ? (relation)->rd_smgr->smgr_targblock : InvalidBlockNumber )
617#define RelationSetTargetBlock(relation, targblock) \
619 RelationGetSmgr(relation)->smgr_targblock = (targblock); \
626#define RelationIsPermanent(relation) \
627 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
637#define RelationNeedsWAL(relation) \
638 (RelationIsPermanent(relation) && (XLogIsNeeded() || \
639 (relation->rd_createSubid == InvalidSubTransactionId && \
640 relation->rd_firstRelfilelocatorSubid == InvalidSubTransactionId)))
646#define RelationUsesLocalBuffers(relation) \
647 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP)
657#define RELATION_IS_LOCAL(relation) \
658 ((relation)->rd_islocaltemp || \
659 (relation)->rd_createSubid != InvalidSubTransactionId)
667#define RELATION_IS_OTHER_TEMP(relation) \
668 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP && \
669 !(relation)->rd_islocaltemp)
678#define RelationIsScannable(relation) ((relation)->rd_rel->relispopulated)
686#define RelationIsPopulated(relation) ((relation)->rd_rel->relispopulated)
693#define RelationIsAccessibleInLogicalDecoding(relation) \
694 (XLogLogicalInfoActive() && \
695 RelationNeedsWAL(relation) && \
696 (IsCatalogRelation(relation) || RelationIsUsedAsCatalogTable(relation)))
710#define RelationIsLogicallyLogged(relation) \
711 (XLogLogicalInfoActive() && \
712 RelationNeedsWAL(relation) && \
713 (relation)->rd_rel->relkind != RELKIND_FOREIGN_TABLE && \
714 !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