347 #define HEAP_MIN_FILLFACTOR 10
348 #define HEAP_DEFAULT_FILLFACTOR 100
354 #define RelationGetToastTupleTarget(relation, defaulttarg) \
355 ((relation)->rd_options ? \
356 ((StdRdOptions *) (relation)->rd_options)->toast_tuple_target : (defaulttarg))
362 #define RelationGetFillFactor(relation, defaultff) \
363 ((relation)->rd_options ? \
364 ((StdRdOptions *) (relation)->rd_options)->fillfactor : (defaultff))
370 #define RelationGetTargetPageUsage(relation, defaultff) \
371 (BLCKSZ * RelationGetFillFactor(relation, defaultff) / 100)
377 #define RelationGetTargetPageFreeSpace(relation, defaultff) \
378 (BLCKSZ * (100 - RelationGetFillFactor(relation, defaultff)) / 100)
385 #define RelationIsUsedAsCatalogTable(relation) \
386 ((relation)->rd_options && \
387 ((relation)->rd_rel->relkind == RELKIND_RELATION || \
388 (relation)->rd_rel->relkind == RELKIND_MATVIEW) ? \
389 ((StdRdOptions *) (relation)->rd_options)->user_catalog_table : false)
396 #define RelationGetParallelWorkers(relation, defaultpw) \
397 ((relation)->rd_options ? \
398 ((StdRdOptions *) (relation)->rd_options)->parallel_workers : (defaultpw))
425 #define RelationIsSecurityView(relation) \
426 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
427 (relation)->rd_options ? \
428 ((ViewOptions *) (relation)->rd_options)->security_barrier : false)
435 #define RelationHasSecurityInvoker(relation) \
436 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
437 (relation)->rd_options ? \
438 ((ViewOptions *) (relation)->rd_options)->security_invoker : false)
445 #define RelationHasCheckOption(relation) \
446 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
447 (relation)->rd_options && \
448 ((ViewOptions *) (relation)->rd_options)->check_option != \
449 VIEW_OPTION_CHECK_OPTION_NOT_SET)
456 #define RelationHasLocalCheckOption(relation) \
457 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
458 (relation)->rd_options && \
459 ((ViewOptions *) (relation)->rd_options)->check_option == \
460 VIEW_OPTION_CHECK_OPTION_LOCAL)
467 #define RelationHasCascadedCheckOption(relation) \
468 (AssertMacro(relation->rd_rel->relkind == RELKIND_VIEW), \
469 (relation)->rd_options && \
470 ((ViewOptions *) (relation)->rd_options)->check_option == \
471 VIEW_OPTION_CHECK_OPTION_CASCADED)
477 #define RelationIsValid(relation) PointerIsValid(relation)
479 #define InvalidRelation ((Relation) NULL)
488 #define RelationHasReferenceCountZero(relation) \
489 ((bool)((relation)->rd_refcnt == 0))
498 #define RelationGetForm(relation) ((relation)->rd_rel)
504 #define RelationGetRelid(relation) ((relation)->rd_id)
510 #define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts)
516 #define IndexRelationGetNumberOfAttributes(relation) \
517 ((relation)->rd_index->indnatts)
523 #define IndexRelationGetNumberOfKeyAttributes(relation) \
524 ((relation)->rd_index->indnkeyatts)
530 #define RelationGetDescr(relation) ((relation)->rd_att)
538 #define RelationGetRelationName(relation) \
539 (NameStr((relation)->rd_rel->relname))
545 #define RelationGetNamespace(relation) \
546 ((relation)->rd_rel->relnamespace)
553 #define RelationIsMapped(relation) \
554 (RELKIND_HAS_STORAGE((relation)->rd_rel->relkind) && \
555 ((relation)->rd_rel->relfilenode == InvalidRelFileNumber))
602 #define RelationGetTargetBlock(relation) \
603 ( (relation)->rd_smgr != NULL ? (relation)->rd_smgr->smgr_targblock : InvalidBlockNumber )
609 #define RelationSetTargetBlock(relation, targblock) \
611 RelationGetSmgr(relation)->smgr_targblock = (targblock); \
618 #define RelationIsPermanent(relation) \
619 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
629 #define RelationNeedsWAL(relation) \
630 (RelationIsPermanent(relation) && (XLogIsNeeded() || \
631 (relation->rd_createSubid == InvalidSubTransactionId && \
632 relation->rd_firstRelfilelocatorSubid == InvalidSubTransactionId)))
638 #define RelationUsesLocalBuffers(relation) \
639 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP)
649 #define RELATION_IS_LOCAL(relation) \
650 ((relation)->rd_islocaltemp || \
651 (relation)->rd_createSubid != InvalidSubTransactionId)
659 #define RELATION_IS_OTHER_TEMP(relation) \
660 ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP && \
661 !(relation)->rd_islocaltemp)
670 #define RelationIsScannable(relation) ((relation)->rd_rel->relispopulated)
678 #define RelationIsPopulated(relation) ((relation)->rd_rel->relispopulated)
685 #define RelationIsAccessibleInLogicalDecoding(relation) \
686 (XLogLogicalInfoActive() && \
687 RelationNeedsWAL(relation) && \
688 (IsCatalogRelation(relation) || RelationIsUsedAsCatalogTable(relation)))
702 #define RelationIsLogicallyLogged(relation) \
703 (XLogLogicalInfoActive() && \
704 RelationNeedsWAL(relation) && \
705 (relation)->rd_rel->relkind != RELKIND_FOREIGN_TABLE && \
706 !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