346 #define HEAP_MIN_FILLFACTOR 10
347 #define HEAP_DEFAULT_FILLFACTOR 100
353 #define RelationGetToastTupleTarget(relation, defaulttarg) \
354 ((relation)->rd_options ? \
355 ((StdRdOptions *) (relation)->rd_options)->toast_tuple_target : (defaulttarg))
361 #define RelationGetFillFactor(relation, defaultff) \
362 ((relation)->rd_options ? \
363 ((StdRdOptions *) (relation)->rd_options)->fillfactor : (defaultff))
369 #define RelationGetTargetPageUsage(relation, defaultff) \
370 (BLCKSZ * RelationGetFillFactor(relation, defaultff) / 100)
376 #define RelationGetTargetPageFreeSpace(relation, defaultff) \
377 (BLCKSZ * (100 - RelationGetFillFactor(relation, defaultff)) / 100)
384 #define RelationIsUsedAsCatalogTable(relation) \
385 ((relation)->rd_options && \
386 ((relation)->rd_rel->relkind == RELKIND_RELATION || \
387 (relation)->rd_rel->relkind == RELKIND_MATVIEW) ? \
388 ((StdRdOptions *) (relation)->rd_options)->user_catalog_table : false)
395 #define RelationGetParallelWorkers(relation, defaultpw) \
396 ((relation)->rd_options ? \
397 ((StdRdOptions *) (relation)->rd_options)->parallel_workers : (defaultpw))
424 #define RelationIsSecurityView(relation) \
425 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
426 (relation)->rd_options ? \
427 ((ViewOptions *) (relation)->rd_options)->security_barrier : false)
434 #define RelationHasSecurityInvoker(relation) \
435 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
436 (relation)->rd_options ? \
437 ((ViewOptions *) (relation)->rd_options)->security_invoker : false)
444 #define RelationHasCheckOption(relation) \
445 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
446 (relation)->rd_options && \
447 ((ViewOptions *) (relation)->rd_options)->check_option != \
448 VIEW_OPTION_CHECK_OPTION_NOT_SET)
455 #define RelationHasLocalCheckOption(relation) \
456 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
457 (relation)->rd_options && \
458 ((ViewOptions *) (relation)->rd_options)->check_option == \
459 VIEW_OPTION_CHECK_OPTION_LOCAL)
466 #define RelationHasCascadedCheckOption(relation) \
467 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
468 (relation)->rd_options && \
469 ((ViewOptions *) (relation)->rd_options)->check_option == \
470 VIEW_OPTION_CHECK_OPTION_CASCADED)
476 #define RelationIsValid(relation) PointerIsValid(relation)
478 #define InvalidRelation ((Relation) NULL)
487 #define RelationHasReferenceCountZero(relation) \
488 ((bool)((relation)->rd_refcnt == 0))
497 #define RelationGetForm(relation) ((relation)->rd_rel)
503 #define RelationGetRelid(relation) ((relation)->rd_id)
509 #define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts)
515 #define IndexRelationGetNumberOfAttributes(relation) \
516 ((relation)->rd_index->indnatts)
522 #define IndexRelationGetNumberOfKeyAttributes(relation) \
523 ((relation)->rd_index->indnkeyatts)
529 #define RelationGetDescr(relation) ((relation)->rd_att)
537 #define RelationGetRelationName(relation) \
538 (NameStr((relation)->rd_rel->relname))
544 #define RelationGetNamespace(relation) \
545 ((relation)->rd_rel->relnamespace)
552 #define RelationIsMapped(relation) \
553 (RELKIND_HAS_STORAGE((relation)->rd_rel->relkind) && \
554 ((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))
Assert(fmt[strlen(fmt) - 1] !='\n')
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
void smgrsetowner(SMgrRelation *owner, SMgrRelation reln)
void smgrclose(SMgrRelation reln)
SMgrRelation smgropen(RelFileLocator rlocator, BackendId backend)
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