PostgreSQL Source Code  git master
rel.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * rel.h
4  * POSTGRES relation descriptor (a/k/a relcache entry) definitions.
5  *
6  *
7  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/utils/rel.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef REL_H
15 #define REL_H
16 
17 #include "access/tupdesc.h"
18 #include "access/xlog.h"
19 #include "catalog/pg_class.h"
20 #include "catalog/pg_index.h"
21 #include "catalog/pg_publication.h"
22 #include "fmgr.h"
23 #include "nodes/bitmapset.h"
24 #include "rewrite/prs2lock.h"
25 #include "storage/block.h"
26 #include "storage/relfilenode.h"
27 #include "utils/relcache.h"
28 #include "utils/reltrigger.h"
29 
30 
31 /*
32  * LockRelId and LockInfo really belong to lmgr.h, but it's more convenient
33  * to declare them here so we can have a LockInfoData field in a Relation.
34  */
35 
36 typedef struct LockRelId
37 {
38  Oid relId; /* a relation identifier */
39  Oid dbId; /* a database identifier */
40 } LockRelId;
41 
42 typedef struct LockInfoData
43 {
45 } LockInfoData;
46 
48 
49 /*
50  * Information about the partition key of a relation
51  */
52 typedef struct PartitionKeyData
53 {
54  char strategy; /* partitioning strategy */
55  int16 partnatts; /* number of columns in the partition key */
56  AttrNumber *partattrs; /* attribute numbers of columns in the
57  * partition key */
58  List *partexprs; /* list of expressions in the partitioning
59  * key, or NIL */
60 
61  Oid *partopfamily; /* OIDs of operator families */
62  Oid *partopcintype; /* OIDs of opclass declared input data types */
63  FmgrInfo *partsupfunc; /* lookup info for support funcs */
64 
65  /* Partitioning collation per attribute */
67 
68  /* Type information per attribute */
72  bool *parttypbyval;
73  char *parttypalign;
76 
78 
79 /*
80  * Here are the contents of a relation cache entry.
81  */
82 
83 typedef struct RelationData
84 {
85  RelFileNode rd_node; /* relation physical identifier */
86  /* use "struct" here to avoid needing to include smgr.h: */
87  struct SMgrRelationData *rd_smgr; /* cached file handle, or NULL */
88  int rd_refcnt; /* reference count */
89  BackendId rd_backend; /* owning backend id, if temporary relation */
90  bool rd_islocaltemp; /* rel is a temp rel of this session */
91  bool rd_isnailed; /* rel is nailed in cache */
92  bool rd_isvalid; /* relcache entry is valid */
93  char rd_indexvalid; /* state of rd_indexlist: 0 = not valid, 1 =
94  * valid, 2 = temporarily forced */
95  bool rd_statvalid; /* is rd_statlist valid? */
96 
97  /*
98  * rd_createSubid is the ID of the highest subtransaction the rel has
99  * survived into; or zero if the rel was not created in the current top
100  * transaction. This can be now be relied on, whereas previously it could
101  * be "forgotten" in earlier releases. Likewise, rd_newRelfilenodeSubid is
102  * the ID of the highest subtransaction the relfilenode change has
103  * survived into, or zero if not changed in the current transaction (or we
104  * have forgotten changing it). rd_newRelfilenodeSubid can be forgotten
105  * when a relation has multiple new relfilenodes within a single
106  * transaction, with one of them occurring in a subsequently aborted
107  * subtransaction, e.g. BEGIN; TRUNCATE t; SAVEPOINT save; TRUNCATE t;
108  * ROLLBACK TO save; -- rd_newRelfilenode is now forgotten
109  */
110  SubTransactionId rd_createSubid; /* rel was created in current xact */
111  SubTransactionId rd_newRelfilenodeSubid; /* new relfilenode assigned in
112  * current xact */
113 
114  Form_pg_class rd_rel; /* RELATION tuple */
115  TupleDesc rd_att; /* tuple descriptor */
116  Oid rd_id; /* relation's object id */
117  LockInfoData rd_lockInfo; /* lock mgr's info for locking relation */
118  RuleLock *rd_rules; /* rewrite rules */
119  MemoryContext rd_rulescxt; /* private memory cxt for rd_rules, if any */
120  TriggerDesc *trigdesc; /* Trigger info, or NULL if rel has none */
121  /* use "struct" here to avoid needing to include rowsecurity.h: */
122  struct RowSecurityDesc *rd_rsdesc; /* row security policies, or NULL */
123 
124  /* data managed by RelationGetFKeyList: */
125  List *rd_fkeylist; /* list of ForeignKeyCacheInfo (see below) */
126  bool rd_fkeyvalid; /* true if list has been computed */
127 
128  MemoryContext rd_partkeycxt; /* private memory cxt for the below */
129  struct PartitionKeyData *rd_partkey; /* partition key, or NULL */
130  MemoryContext rd_pdcxt; /* private context for partdesc */
131  struct PartitionDescData *rd_partdesc; /* partitions, or NULL */
132  List *rd_partcheck; /* partition CHECK quals */
133 
134  /* data managed by RelationGetIndexList: */
135  List *rd_indexlist; /* list of OIDs of indexes on relation */
136  Oid rd_oidindex; /* OID of unique index on OID, if any */
137  Oid rd_pkindex; /* OID of primary key, if any */
138  Oid rd_replidindex; /* OID of replica identity index, if any */
139 
140  /* data managed by RelationGetStatExtList: */
141  List *rd_statlist; /* list of OIDs of extended stats */
142 
143  /* data managed by RelationGetIndexAttrBitmap: */
144  Bitmapset *rd_indexattr; /* identifies columns used in indexes */
145  Bitmapset *rd_keyattr; /* cols that can be ref'd by foreign keys */
146  Bitmapset *rd_pkattr; /* cols included in primary key */
147  Bitmapset *rd_idattr; /* included in replica identity index */
148 
149  PublicationActions *rd_pubactions; /* publication actions */
150 
151  /*
152  * rd_options is set whenever rd_rel is loaded into the relcache entry.
153  * Note that you can NOT look into rd_rel for this data. NULL means "use
154  * defaults".
155  */
156  bytea *rd_options; /* parsed pg_class.reloptions */
157 
158  /* These are non-NULL only for an index relation: */
159  Form_pg_index rd_index; /* pg_index tuple describing this index */
160  /* use "struct" here to avoid needing to include htup.h: */
161  struct HeapTupleData *rd_indextuple; /* all of pg_index tuple */
162 
163  /*
164  * index access support info (used only for an index relation)
165  *
166  * Note: only default support procs for each opclass are cached, namely
167  * those with lefttype and righttype equal to the opclass's opcintype. The
168  * arrays are indexed by support function number, which is a sufficient
169  * identifier given that restriction.
170  *
171  * Note: rd_amcache is available for index AMs to cache private data about
172  * an index. This must be just a cache since it may get reset at any time
173  * (in particular, it will get reset by a relcache inval message for the
174  * index). If used, it must point to a single memory chunk palloc'd in
175  * rd_indexcxt. A relcache reset will include freeing that chunk and
176  * setting rd_amcache = NULL.
177  */
178  Oid rd_amhandler; /* OID of index AM's handler function */
179  MemoryContext rd_indexcxt; /* private memory cxt for this stuff */
180  /* use "struct" here to avoid needing to include amapi.h: */
181  struct IndexAmRoutine *rd_amroutine; /* index AM's API struct */
182  Oid *rd_opfamily; /* OIDs of op families for each index col */
183  Oid *rd_opcintype; /* OIDs of opclass declared input data types */
184  RegProcedure *rd_support; /* OIDs of support procedures */
185  FmgrInfo *rd_supportinfo; /* lookup info for support procedures */
186  int16 *rd_indoption; /* per-column AM-specific flags */
187  List *rd_indexprs; /* index expression trees, if any */
188  List *rd_indpred; /* index predicate tree, if any */
189  Oid *rd_exclops; /* OIDs of exclusion operators, if any */
190  Oid *rd_exclprocs; /* OIDs of exclusion ops' procs, if any */
191  uint16 *rd_exclstrats; /* exclusion ops' strategy numbers, if any */
192  void *rd_amcache; /* available for use by index AM */
193  Oid *rd_indcollation; /* OIDs of index collations */
194 
195  /*
196  * foreign-table support
197  *
198  * rd_fdwroutine must point to a single memory chunk palloc'd in
199  * CacheMemoryContext. It will be freed and reset to NULL on a relcache
200  * reset.
201  */
202 
203  /* use "struct" here to avoid needing to include fdwapi.h: */
204  struct FdwRoutine *rd_fdwroutine; /* cached function pointers, or NULL */
205 
206  /*
207  * Hack for CLUSTER, rewriting ALTER TABLE, etc: when writing a new
208  * version of a table, we need to make any toast pointers inserted into it
209  * have the existing toast table's OID, not the OID of the transient toast
210  * table. If rd_toastoid isn't InvalidOid, it is the OID to place in
211  * toast pointers inserted into this rel. (Note it's set on the new
212  * version of the main heap, not the toast table itself.) This also
213  * causes toast_save_datum() to try to preserve toast value OIDs.
214  */
215  Oid rd_toastoid; /* Real TOAST table's OID, or InvalidOid */
216 
217  /* use "struct" here to avoid needing to include pgstat.h: */
218  struct PgStat_TableStatus *pgstat_info; /* statistics collection area */
219 } RelationData;
220 
221 
222 /*
223  * ForeignKeyCacheInfo
224  * Information the relcache can cache about foreign key constraints
225  *
226  * This is basically just an image of relevant columns from pg_constraint.
227  * We make it a subclass of Node so that copyObject() can be used on a list
228  * of these, but we also ensure it is a "flat" object without substructure,
229  * so that list_free_deep() is sufficient to free such a list.
230  * The per-FK-column arrays can be fixed-size because we allow at most
231  * INDEX_MAX_KEYS columns in a foreign key constraint.
232  *
233  * Currently, we only cache fields of interest to the planner, but the
234  * set of fields could be expanded in future.
235  */
236 typedef struct ForeignKeyCacheInfo
237 {
239  Oid conrelid; /* relation constrained by the foreign key */
240  Oid confrelid; /* relation referenced by the foreign key */
241  int nkeys; /* number of columns in the foreign key */
242  /* these arrays each have nkeys valid entries: */
243  AttrNumber conkey[INDEX_MAX_KEYS]; /* cols in referencing table */
244  AttrNumber confkey[INDEX_MAX_KEYS]; /* cols in referenced table */
245  Oid conpfeqop[INDEX_MAX_KEYS]; /* PK = FK operator OIDs */
247 
248 
249 /*
250  * StdRdOptions
251  * Standard contents of rd_options for heaps and generic indexes.
252  *
253  * RelationGetFillFactor() and RelationGetTargetPageFreeSpace() can only
254  * be applied to relations that use this format or a superset for
255  * private options data.
256  */
257  /* autovacuum-related reloptions. */
258 typedef struct AutoVacOpts
259 {
260  bool enabled;
274 } AutoVacOpts;
275 
276 typedef struct StdRdOptions
277 {
278  int32 vl_len_; /* varlena header (do not touch directly!) */
279  int fillfactor; /* page fill factor in percent (0..100) */
280  int toast_tuple_target; /* target for tuple toasting */
281  AutoVacOpts autovacuum; /* autovacuum-related options */
282  bool user_catalog_table; /* use as an additional catalog relation */
283  int parallel_workers; /* max number of parallel workers */
284 } StdRdOptions;
285 
286 #define HEAP_MIN_FILLFACTOR 10
287 #define HEAP_DEFAULT_FILLFACTOR 100
288 
289 /*
290  * RelationGetToastTupleTarget
291  * Returns the relation's toast_tuple_target. Note multiple eval of argument!
292  */
293 #define RelationGetToastTupleTarget(relation, defaulttarg) \
294  ((relation)->rd_options ? \
295  ((StdRdOptions *) (relation)->rd_options)->toast_tuple_target : (defaulttarg))
296 
297 /*
298  * RelationGetFillFactor
299  * Returns the relation's fillfactor. Note multiple eval of argument!
300  */
301 #define RelationGetFillFactor(relation, defaultff) \
302  ((relation)->rd_options ? \
303  ((StdRdOptions *) (relation)->rd_options)->fillfactor : (defaultff))
304 
305 /*
306  * RelationGetTargetPageUsage
307  * Returns the relation's desired space usage per page in bytes.
308  */
309 #define RelationGetTargetPageUsage(relation, defaultff) \
310  (BLCKSZ * RelationGetFillFactor(relation, defaultff) / 100)
311 
312 /*
313  * RelationGetTargetPageFreeSpace
314  * Returns the relation's desired freespace per page in bytes.
315  */
316 #define RelationGetTargetPageFreeSpace(relation, defaultff) \
317  (BLCKSZ * (100 - RelationGetFillFactor(relation, defaultff)) / 100)
318 
319 /*
320  * RelationIsUsedAsCatalogTable
321  * Returns whether the relation should be treated as a catalog table
322  * from the pov of logical decoding. Note multiple eval of argument!
323  */
324 #define RelationIsUsedAsCatalogTable(relation) \
325  ((relation)->rd_options && \
326  ((relation)->rd_rel->relkind == RELKIND_RELATION || \
327  (relation)->rd_rel->relkind == RELKIND_MATVIEW) ? \
328  ((StdRdOptions *) (relation)->rd_options)->user_catalog_table : false)
329 
330 /*
331  * RelationGetParallelWorkers
332  * Returns the relation's parallel_workers reloption setting.
333  * Note multiple eval of argument!
334  */
335 #define RelationGetParallelWorkers(relation, defaultpw) \
336  ((relation)->rd_options ? \
337  ((StdRdOptions *) (relation)->rd_options)->parallel_workers : (defaultpw))
338 
339 
340 /*
341  * ViewOptions
342  * Contents of rd_options for views
343  */
344 typedef struct ViewOptions
345 {
346  int32 vl_len_; /* varlena header (do not touch directly!) */
349 } ViewOptions;
350 
351 /*
352  * RelationIsSecurityView
353  * Returns whether the relation is security view, or not. Note multiple
354  * eval of argument!
355  */
356 #define RelationIsSecurityView(relation) \
357  ((relation)->rd_options ? \
358  ((ViewOptions *) (relation)->rd_options)->security_barrier : false)
359 
360 /*
361  * RelationHasCheckOption
362  * Returns true if the relation is a view defined with either the local
363  * or the cascaded check option. Note multiple eval of argument!
364  */
365 #define RelationHasCheckOption(relation) \
366  ((relation)->rd_options && \
367  ((ViewOptions *) (relation)->rd_options)->check_option_offset != 0)
368 
369 /*
370  * RelationHasLocalCheckOption
371  * Returns true if the relation is a view defined with the local check
372  * option. Note multiple eval of argument!
373  */
374 #define RelationHasLocalCheckOption(relation) \
375  ((relation)->rd_options && \
376  ((ViewOptions *) (relation)->rd_options)->check_option_offset != 0 ? \
377  strcmp((char *) (relation)->rd_options + \
378  ((ViewOptions *) (relation)->rd_options)->check_option_offset, \
379  "local") == 0 : false)
380 
381 /*
382  * RelationHasCascadedCheckOption
383  * Returns true if the relation is a view defined with the cascaded check
384  * option. Note multiple eval of argument!
385  */
386 #define RelationHasCascadedCheckOption(relation) \
387  ((relation)->rd_options && \
388  ((ViewOptions *) (relation)->rd_options)->check_option_offset != 0 ? \
389  strcmp((char *) (relation)->rd_options + \
390  ((ViewOptions *) (relation)->rd_options)->check_option_offset, \
391  "cascaded") == 0 : false)
392 
393 
394 /*
395  * RelationIsValid
396  * True iff relation descriptor is valid.
397  */
398 #define RelationIsValid(relation) PointerIsValid(relation)
399 
400 #define InvalidRelation ((Relation) NULL)
401 
402 /*
403  * RelationHasReferenceCountZero
404  * True iff relation reference count is zero.
405  *
406  * Note:
407  * Assumes relation descriptor is valid.
408  */
409 #define RelationHasReferenceCountZero(relation) \
410  ((bool)((relation)->rd_refcnt == 0))
411 
412 /*
413  * RelationGetForm
414  * Returns pg_class tuple for a relation.
415  *
416  * Note:
417  * Assumes relation descriptor is valid.
418  */
419 #define RelationGetForm(relation) ((relation)->rd_rel)
420 
421 /*
422  * RelationGetRelid
423  * Returns the OID of the relation
424  */
425 #define RelationGetRelid(relation) ((relation)->rd_id)
426 
427 /*
428  * RelationGetNumberOfAttributes
429  * Returns the number of attributes in a relation.
430  */
431 #define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts)
432 
433 /*
434  * RelationGetDescr
435  * Returns tuple descriptor for a relation.
436  */
437 #define RelationGetDescr(relation) ((relation)->rd_att)
438 
439 /*
440  * RelationGetRelationName
441  * Returns the rel's name.
442  *
443  * Note that the name is only unique within the containing namespace.
444  */
445 #define RelationGetRelationName(relation) \
446  (NameStr((relation)->rd_rel->relname))
447 
448 /*
449  * RelationGetNamespace
450  * Returns the rel's namespace OID.
451  */
452 #define RelationGetNamespace(relation) \
453  ((relation)->rd_rel->relnamespace)
454 
455 /*
456  * RelationIsMapped
457  * True if the relation uses the relfilenode map.
458  *
459  * NB: this is only meaningful for relkinds that have storage, else it
460  * will misleadingly say "true".
461  */
462 #define RelationIsMapped(relation) \
463  ((relation)->rd_rel->relfilenode == InvalidOid)
464 
465 /*
466  * RelationOpenSmgr
467  * Open the relation at the smgr level, if not already done.
468  */
469 #define RelationOpenSmgr(relation) \
470  do { \
471  if ((relation)->rd_smgr == NULL) \
472  smgrsetowner(&((relation)->rd_smgr), smgropen((relation)->rd_node, (relation)->rd_backend)); \
473  } while (0)
474 
475 /*
476  * RelationCloseSmgr
477  * Close the relation at the smgr level, if not already done.
478  *
479  * Note: smgrclose should unhook from owner pointer, hence the Assert.
480  */
481 #define RelationCloseSmgr(relation) \
482  do { \
483  if ((relation)->rd_smgr != NULL) \
484  { \
485  smgrclose((relation)->rd_smgr); \
486  Assert((relation)->rd_smgr == NULL); \
487  } \
488  } while (0)
489 
490 /*
491  * RelationGetTargetBlock
492  * Fetch relation's current insertion target block.
493  *
494  * Returns InvalidBlockNumber if there is no current target block. Note
495  * that the target block status is discarded on any smgr-level invalidation.
496  */
497 #define RelationGetTargetBlock(relation) \
498  ( (relation)->rd_smgr != NULL ? (relation)->rd_smgr->smgr_targblock : InvalidBlockNumber )
499 
500 /*
501  * RelationSetTargetBlock
502  * Set relation's current insertion target block.
503  */
504 #define RelationSetTargetBlock(relation, targblock) \
505  do { \
506  RelationOpenSmgr(relation); \
507  (relation)->rd_smgr->smgr_targblock = (targblock); \
508  } while (0)
509 
510 /*
511  * RelationNeedsWAL
512  * True if relation needs WAL.
513  */
514 #define RelationNeedsWAL(relation) \
515  ((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
516 
517 /*
518  * RelationUsesLocalBuffers
519  * True if relation's pages are stored in local buffers.
520  */
521 #define RelationUsesLocalBuffers(relation) \
522  ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP)
523 
524 /*
525  * RELATION_IS_LOCAL
526  * If a rel is either temp or newly created in the current transaction,
527  * it can be assumed to be accessible only to the current backend.
528  * This is typically used to decide that we can skip acquiring locks.
529  *
530  * Beware of multiple eval of argument
531  */
532 #define RELATION_IS_LOCAL(relation) \
533  ((relation)->rd_islocaltemp || \
534  (relation)->rd_createSubid != InvalidSubTransactionId)
535 
536 /*
537  * RELATION_IS_OTHER_TEMP
538  * Test for a temporary relation that belongs to some other session.
539  *
540  * Beware of multiple eval of argument
541  */
542 #define RELATION_IS_OTHER_TEMP(relation) \
543  ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP && \
544  !(relation)->rd_islocaltemp)
545 
546 
547 /*
548  * RelationIsScannable
549  * Currently can only be false for a materialized view which has not been
550  * populated by its query. This is likely to get more complicated later,
551  * so use a macro which looks like a function.
552  */
553 #define RelationIsScannable(relation) ((relation)->rd_rel->relispopulated)
554 
555 /*
556  * RelationIsPopulated
557  * Currently, we don't physically distinguish the "populated" and
558  * "scannable" properties of matviews, but that may change later.
559  * Hence, use the appropriate one of these macros in code tests.
560  */
561 #define RelationIsPopulated(relation) ((relation)->rd_rel->relispopulated)
562 
563 /*
564  * RelationIsAccessibleInLogicalDecoding
565  * True if we need to log enough information to have access via
566  * decoding snapshot.
567  */
568 #define RelationIsAccessibleInLogicalDecoding(relation) \
569  (XLogLogicalInfoActive() && \
570  RelationNeedsWAL(relation) && \
571  (IsCatalogRelation(relation) || RelationIsUsedAsCatalogTable(relation)))
572 
573 /*
574  * RelationIsLogicallyLogged
575  * True if we need to log enough information to extract the data from the
576  * WAL stream.
577  *
578  * We don't log information for unlogged tables (since they don't WAL log
579  * anyway) and for system tables (their content is hard to make sense of, and
580  * it would complicate decoding slightly for little gain). Note that we *do*
581  * log information for user defined catalog tables since they presumably are
582  * interesting to the user...
583  */
584 #define RelationIsLogicallyLogged(relation) \
585  (XLogLogicalInfoActive() && \
586  RelationNeedsWAL(relation) && \
587  !IsCatalogRelation(relation))
588 
589 /*
590  * RelationGetPartitionKey
591  * Returns the PartitionKey of a relation
592  */
593 #define RelationGetPartitionKey(relation) ((relation)->rd_partkey)
594 
595 /*
596  * PartitionKey inquiry functions
597  */
598 static inline int
599 get_partition_strategy(PartitionKey key)
600 {
601  return key->strategy;
602 }
603 
604 static inline int
605 get_partition_natts(PartitionKey key)
606 {
607  return key->partnatts;
608 }
609 
610 static inline List *
611 get_partition_exprs(PartitionKey key)
612 {
613  return key->partexprs;
614 }
615 
616 /*
617  * PartitionKey inquiry functions - one column
618  */
619 static inline int16
620 get_partition_col_attnum(PartitionKey key, int col)
621 {
622  return key->partattrs[col];
623 }
624 
625 static inline Oid
626 get_partition_col_typid(PartitionKey key, int col)
627 {
628  return key->parttypid[col];
629 }
630 
631 static inline int32
632 get_partition_col_typmod(PartitionKey key, int col)
633 {
634  return key->parttypmod[col];
635 }
636 
637 /*
638  * RelationGetPartitionDesc
639  * Returns partition descriptor for a relation.
640  */
641 #define RelationGetPartitionDesc(relation) ((relation)->rd_partdesc)
642 
643 /* routines in utils/cache/relcache.c */
646 extern bool RelationHasUnloggedIndex(Relation rel);
647 extern List *RelationGetRepsetList(Relation rel);
648 
649 #endif /* REL_H */
struct FdwRoutine * rd_fdwroutine
Definition: rel.h:204
int vacuum_cost_delay
Definition: rel.h:263
List * RelationGetRepsetList(Relation rel)
signed short int16
Definition: c.h:283
Definition: fmgr.h:56
struct PartitionKeyData PartitionKeyData
struct PartitionDescData * rd_partdesc
Definition: rel.h:131
LockRelId lockRelId
Definition: rel.h:44
int16 * rd_indoption
Definition: rel.h:186
struct LockInfoData LockInfoData
PublicationActions * rd_pubactions
Definition: rel.h:149
FmgrInfo * rd_supportinfo
Definition: rel.h:185
Bitmapset * rd_keyattr
Definition: rel.h:145
Oid * partopfamily
Definition: rel.h:61
FmgrInfo * partsupfunc
Definition: rel.h:63
float8 vacuum_scale_factor
Definition: rel.h:272
int freeze_min_age
Definition: rel.h:265
Oid rd_replidindex
Definition: rel.h:138
struct SMgrRelationData * rd_smgr
Definition: rel.h:87
bool rd_isnailed
Definition: rel.h:91
regproc RegProcedure
Definition: c.h:443
bool rd_islocaltemp
Definition: rel.h:90
Oid dbId
Definition: rel.h:39
struct ForeignKeyCacheInfo ForeignKeyCacheInfo
uint16 * rd_exclstrats
Definition: rel.h:191
List * rd_indexprs
Definition: rel.h:187
List * rd_fkeylist
Definition: rel.h:125
int fillfactor
Definition: rel.h:279
bool rd_isvalid
Definition: rel.h:92
SubTransactionId rd_newRelfilenodeSubid
Definition: rel.h:111
struct AutoVacOpts AutoVacOpts
MemoryContext rd_rulescxt
Definition: rel.h:119
uint32 SubTransactionId
Definition: c.h:449
List * partexprs
Definition: rel.h:58
Oid * rd_exclprocs
Definition: rel.h:190
char strategy
Definition: rel.h:54
bool RelationHasUnloggedIndex(Relation rel)
Definition: relcache.c:5998
Form_pg_class rd_rel
Definition: rel.h:114
unsigned int Oid
Definition: postgres_ext.h:31
NodeTag
Definition: nodes.h:26
struct IndexAmRoutine * rd_amroutine
Definition: rel.h:181
LockInfoData * LockInfo
Definition: rel.h:47
signed int int32
Definition: c.h:284
struct HeapTupleData * rd_indextuple
Definition: rel.h:161
int freeze_table_age
Definition: rel.h:267
static int get_partition_natts(PartitionKey key)
Definition: rel.h:605
static int16 get_partition_col_attnum(PartitionKey key, int col)
Definition: rel.h:620
int parallel_workers
Definition: rel.h:283
int32 vl_len_
Definition: rel.h:278
Form_pg_index rd_index
Definition: rel.h:159
unsigned short uint16
Definition: c.h:295
Oid * parttypcoll
Definition: rel.h:74
Oid * rd_indcollation
Definition: rel.h:193
Oid rd_amhandler
Definition: rel.h:178
double float8
Definition: c.h:429
Definition: rel.h:36
int toast_tuple_target
Definition: rel.h:280
bool security_barrier
Definition: rel.h:347
Oid rd_pkindex
Definition: rel.h:137
int32 vl_len_
Definition: rel.h:346
struct PartitionKeyData * rd_partkey
Definition: rel.h:129
TriggerDesc * trigdesc
Definition: rel.h:120
NodeTag type
Definition: rel.h:238
int analyze_threshold
Definition: rel.h:262
LockInfoData rd_lockInfo
Definition: rel.h:117
static List * get_partition_exprs(PartitionKey key)
Definition: rel.h:611
char rd_indexvalid
Definition: rel.h:93
Oid rd_toastoid
Definition: rel.h:215
List * rd_indpred
Definition: rel.h:188
Oid rd_oidindex
Definition: rel.h:136
Oid * rd_opfamily
Definition: rel.h:182
Oid * rd_exclops
Definition: rel.h:189
List * rd_indexlist
Definition: rel.h:135
struct RowSecurityDesc * rd_rsdesc
Definition: rel.h:122
RegProcedure * rd_support
Definition: rel.h:184
Oid * parttypid
Definition: rel.h:69
struct LockRelId LockRelId
Oid rd_id
Definition: rel.h:116
void RelationDecrementReferenceCount(Relation rel)
Definition: relcache.c:2147
static int32 get_partition_col_typmod(PartitionKey key, int col)
Definition: rel.h:632
FormData_pg_index * Form_pg_index
Definition: pg_index.h:67
SubTransactionId rd_createSubid
Definition: rel.h:110
struct StdRdOptions StdRdOptions
int multixact_freeze_table_age
Definition: rel.h:270
Oid * partcollation
Definition: rel.h:66
int vacuum_threshold
Definition: rel.h:261
AttrNumber * partattrs
Definition: rel.h:56
static Oid get_partition_col_typid(PartitionKey key, int col)
Definition: rel.h:626
int16 partnatts
Definition: rel.h:55
char * parttypalign
Definition: rel.h:73
int BackendId
Definition: backendid.h:21
static int get_partition_strategy(PartitionKey key)
Definition: rel.h:599
TupleDesc rd_att
Definition: rel.h:115
int32 * parttypmod
Definition: rel.h:70
Bitmapset * rd_idattr
Definition: rel.h:147
float8 analyze_scale_factor
Definition: rel.h:273
RelFileNode rd_node
Definition: rel.h:85
int freeze_max_age
Definition: rel.h:266
int vacuum_cost_limit
Definition: rel.h:264
bool * parttypbyval
Definition: rel.h:72
MemoryContext rd_pdcxt
Definition: rel.h:130
BackendId rd_backend
Definition: rel.h:89
int16 * parttyplen
Definition: rel.h:71
bool enabled
Definition: rel.h:260
MemoryContext rd_partkeycxt
Definition: rel.h:128
int multixact_freeze_min_age
Definition: rel.h:268
RuleLock * rd_rules
Definition: rel.h:118
#define INDEX_MAX_KEYS
struct PgStat_TableStatus * pgstat_info
Definition: rel.h:218
int check_option_offset
Definition: rel.h:348
int log_min_duration
Definition: rel.h:271
FormData_pg_class * Form_pg_class
Definition: pg_class.h:95
Bitmapset * rd_pkattr
Definition: rel.h:146
bool rd_statvalid
Definition: rel.h:95
struct ViewOptions ViewOptions
struct PartitionKeyData * PartitionKey
Definition: rel.h:77
int rd_refcnt
Definition: rel.h:88
Oid * partopcintype
Definition: rel.h:62
MemoryContext rd_indexcxt
Definition: rel.h:179
int multixact_freeze_max_age
Definition: rel.h:269
Definition: c.h:487
void RelationIncrementReferenceCount(Relation rel)
Definition: relcache.c:2134
void * rd_amcache
Definition: rel.h:192
Oid * rd_opcintype
Definition: rel.h:183
struct RelationData RelationData
List * rd_statlist
Definition: rel.h:141
Definition: pg_list.h:45
bool rd_fkeyvalid
Definition: rel.h:126
int16 AttrNumber
Definition: attnum.h:21
List * rd_partcheck
Definition: rel.h:132
Bitmapset * rd_indexattr
Definition: rel.h:144
bytea * rd_options
Definition: rel.h:156
bool user_catalog_table
Definition: rel.h:282
Oid relId
Definition: rel.h:38
AutoVacOpts autovacuum
Definition: rel.h:281