PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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  AutoVacOpts autovacuum; /* autovacuum-related options */
281  bool user_catalog_table; /* use as an additional catalog
282  * 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  * RelationGetFillFactor
291  * Returns the relation's fillfactor. Note multiple eval of argument!
292  */
293 #define RelationGetFillFactor(relation, defaultff) \
294  ((relation)->rd_options ? \
295  ((StdRdOptions *) (relation)->rd_options)->fillfactor : (defaultff))
296 
297 /*
298  * RelationGetTargetPageUsage
299  * Returns the relation's desired space usage per page in bytes.
300  */
301 #define RelationGetTargetPageUsage(relation, defaultff) \
302  (BLCKSZ * RelationGetFillFactor(relation, defaultff) / 100)
303 
304 /*
305  * RelationGetTargetPageFreeSpace
306  * Returns the relation's desired freespace per page in bytes.
307  */
308 #define RelationGetTargetPageFreeSpace(relation, defaultff) \
309  (BLCKSZ * (100 - RelationGetFillFactor(relation, defaultff)) / 100)
310 
311 /*
312  * RelationIsUsedAsCatalogTable
313  * Returns whether the relation should be treated as a catalog table
314  * from the pov of logical decoding. Note multiple eval of argument!
315  */
316 #define RelationIsUsedAsCatalogTable(relation) \
317  ((relation)->rd_options && \
318  ((relation)->rd_rel->relkind == RELKIND_RELATION || \
319  (relation)->rd_rel->relkind == RELKIND_MATVIEW) ? \
320  ((StdRdOptions *) (relation)->rd_options)->user_catalog_table : false)
321 
322 /*
323  * RelationGetParallelWorkers
324  * Returns the relation's parallel_workers reloption setting.
325  * Note multiple eval of argument!
326  */
327 #define RelationGetParallelWorkers(relation, defaultpw) \
328  ((relation)->rd_options ? \
329  ((StdRdOptions *) (relation)->rd_options)->parallel_workers : (defaultpw))
330 
331 
332 /*
333  * ViewOptions
334  * Contents of rd_options for views
335  */
336 typedef struct ViewOptions
337 {
338  int32 vl_len_; /* varlena header (do not touch directly!) */
341 } ViewOptions;
342 
343 /*
344  * RelationIsSecurityView
345  * Returns whether the relation is security view, or not. Note multiple
346  * eval of argument!
347  */
348 #define RelationIsSecurityView(relation) \
349  ((relation)->rd_options ? \
350  ((ViewOptions *) (relation)->rd_options)->security_barrier : false)
351 
352 /*
353  * RelationHasCheckOption
354  * Returns true if the relation is a view defined with either the local
355  * or the cascaded check option. Note multiple eval of argument!
356  */
357 #define RelationHasCheckOption(relation) \
358  ((relation)->rd_options && \
359  ((ViewOptions *) (relation)->rd_options)->check_option_offset != 0)
360 
361 /*
362  * RelationHasLocalCheckOption
363  * Returns true if the relation is a view defined with the local check
364  * option. Note multiple eval of argument!
365  */
366 #define RelationHasLocalCheckOption(relation) \
367  ((relation)->rd_options && \
368  ((ViewOptions *) (relation)->rd_options)->check_option_offset != 0 ? \
369  strcmp((char *) (relation)->rd_options + \
370  ((ViewOptions *) (relation)->rd_options)->check_option_offset, \
371  "local") == 0 : false)
372 
373 /*
374  * RelationHasCascadedCheckOption
375  * Returns true if the relation is a view defined with the cascaded check
376  * option. Note multiple eval of argument!
377  */
378 #define RelationHasCascadedCheckOption(relation) \
379  ((relation)->rd_options && \
380  ((ViewOptions *) (relation)->rd_options)->check_option_offset != 0 ? \
381  strcmp((char *) (relation)->rd_options + \
382  ((ViewOptions *) (relation)->rd_options)->check_option_offset, \
383  "cascaded") == 0 : false)
384 
385 
386 /*
387  * RelationIsValid
388  * True iff relation descriptor is valid.
389  */
390 #define RelationIsValid(relation) PointerIsValid(relation)
391 
392 #define InvalidRelation ((Relation) NULL)
393 
394 /*
395  * RelationHasReferenceCountZero
396  * True iff relation reference count is zero.
397  *
398  * Note:
399  * Assumes relation descriptor is valid.
400  */
401 #define RelationHasReferenceCountZero(relation) \
402  ((bool)((relation)->rd_refcnt == 0))
403 
404 /*
405  * RelationGetForm
406  * Returns pg_class tuple for a relation.
407  *
408  * Note:
409  * Assumes relation descriptor is valid.
410  */
411 #define RelationGetForm(relation) ((relation)->rd_rel)
412 
413 /*
414  * RelationGetRelid
415  * Returns the OID of the relation
416  */
417 #define RelationGetRelid(relation) ((relation)->rd_id)
418 
419 /*
420  * RelationGetNumberOfAttributes
421  * Returns the number of attributes in a relation.
422  */
423 #define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts)
424 
425 /*
426  * RelationGetDescr
427  * Returns tuple descriptor for a relation.
428  */
429 #define RelationGetDescr(relation) ((relation)->rd_att)
430 
431 /*
432  * RelationGetRelationName
433  * Returns the rel's name.
434  *
435  * Note that the name is only unique within the containing namespace.
436  */
437 #define RelationGetRelationName(relation) \
438  (NameStr((relation)->rd_rel->relname))
439 
440 /*
441  * RelationGetNamespace
442  * Returns the rel's namespace OID.
443  */
444 #define RelationGetNamespace(relation) \
445  ((relation)->rd_rel->relnamespace)
446 
447 /*
448  * RelationIsMapped
449  * True if the relation uses the relfilenode map.
450  *
451  * NB: this is only meaningful for relkinds that have storage, else it
452  * will misleadingly say "true".
453  */
454 #define RelationIsMapped(relation) \
455  ((relation)->rd_rel->relfilenode == InvalidOid)
456 
457 /*
458  * RelationOpenSmgr
459  * Open the relation at the smgr level, if not already done.
460  */
461 #define RelationOpenSmgr(relation) \
462  do { \
463  if ((relation)->rd_smgr == NULL) \
464  smgrsetowner(&((relation)->rd_smgr), smgropen((relation)->rd_node, (relation)->rd_backend)); \
465  } while (0)
466 
467 /*
468  * RelationCloseSmgr
469  * Close the relation at the smgr level, if not already done.
470  *
471  * Note: smgrclose should unhook from owner pointer, hence the Assert.
472  */
473 #define RelationCloseSmgr(relation) \
474  do { \
475  if ((relation)->rd_smgr != NULL) \
476  { \
477  smgrclose((relation)->rd_smgr); \
478  Assert((relation)->rd_smgr == NULL); \
479  } \
480  } while (0)
481 
482 /*
483  * RelationGetTargetBlock
484  * Fetch relation's current insertion target block.
485  *
486  * Returns InvalidBlockNumber if there is no current target block. Note
487  * that the target block status is discarded on any smgr-level invalidation.
488  */
489 #define RelationGetTargetBlock(relation) \
490  ( (relation)->rd_smgr != NULL ? (relation)->rd_smgr->smgr_targblock : InvalidBlockNumber )
491 
492 /*
493  * RelationSetTargetBlock
494  * Set relation's current insertion target block.
495  */
496 #define RelationSetTargetBlock(relation, targblock) \
497  do { \
498  RelationOpenSmgr(relation); \
499  (relation)->rd_smgr->smgr_targblock = (targblock); \
500  } while (0)
501 
502 /*
503  * RelationNeedsWAL
504  * True if relation needs WAL.
505  */
506 #define RelationNeedsWAL(relation) \
507  ((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
508 
509 /*
510  * RelationUsesLocalBuffers
511  * True if relation's pages are stored in local buffers.
512  */
513 #define RelationUsesLocalBuffers(relation) \
514  ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP)
515 
516 /*
517  * RELATION_IS_LOCAL
518  * If a rel is either temp or newly created in the current transaction,
519  * it can be assumed to be accessible only to the current backend.
520  * This is typically used to decide that we can skip acquiring locks.
521  *
522  * Beware of multiple eval of argument
523  */
524 #define RELATION_IS_LOCAL(relation) \
525  ((relation)->rd_islocaltemp || \
526  (relation)->rd_createSubid != InvalidSubTransactionId)
527 
528 /*
529  * RELATION_IS_OTHER_TEMP
530  * Test for a temporary relation that belongs to some other session.
531  *
532  * Beware of multiple eval of argument
533  */
534 #define RELATION_IS_OTHER_TEMP(relation) \
535  ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP && \
536  !(relation)->rd_islocaltemp)
537 
538 
539 /*
540  * RelationIsScannable
541  * Currently can only be false for a materialized view which has not been
542  * populated by its query. This is likely to get more complicated later,
543  * so use a macro which looks like a function.
544  */
545 #define RelationIsScannable(relation) ((relation)->rd_rel->relispopulated)
546 
547 /*
548  * RelationIsPopulated
549  * Currently, we don't physically distinguish the "populated" and
550  * "scannable" properties of matviews, but that may change later.
551  * Hence, use the appropriate one of these macros in code tests.
552  */
553 #define RelationIsPopulated(relation) ((relation)->rd_rel->relispopulated)
554 
555 /*
556  * RelationIsAccessibleInLogicalDecoding
557  * True if we need to log enough information to have access via
558  * decoding snapshot.
559  */
560 #define RelationIsAccessibleInLogicalDecoding(relation) \
561  (XLogLogicalInfoActive() && \
562  RelationNeedsWAL(relation) && \
563  (IsCatalogRelation(relation) || RelationIsUsedAsCatalogTable(relation)))
564 
565 /*
566  * RelationIsLogicallyLogged
567  * True if we need to log enough information to extract the data from the
568  * WAL stream.
569  *
570  * We don't log information for unlogged tables (since they don't WAL log
571  * anyway) and for system tables (their content is hard to make sense of, and
572  * it would complicate decoding slightly for little gain). Note that we *do*
573  * log information for user defined catalog tables since they presumably are
574  * interesting to the user...
575  */
576 #define RelationIsLogicallyLogged(relation) \
577  (XLogLogicalInfoActive() && \
578  RelationNeedsWAL(relation) && \
579  !IsCatalogRelation(relation))
580 
581 /*
582  * RelationGetPartitionKey
583  * Returns the PartitionKey of a relation
584  */
585 #define RelationGetPartitionKey(relation) ((relation)->rd_partkey)
586 
587 /*
588  * PartitionKey inquiry functions
589  */
590 static inline int
591 get_partition_strategy(PartitionKey key)
592 {
593  return key->strategy;
594 }
595 
596 static inline int
597 get_partition_natts(PartitionKey key)
598 {
599  return key->partnatts;
600 }
601 
602 static inline List *
603 get_partition_exprs(PartitionKey key)
604 {
605  return key->partexprs;
606 }
607 
608 /*
609  * PartitionKey inquiry functions - one column
610  */
611 static inline int16
612 get_partition_col_attnum(PartitionKey key, int col)
613 {
614  return key->partattrs[col];
615 }
616 
617 static inline Oid
618 get_partition_col_typid(PartitionKey key, int col)
619 {
620  return key->parttypid[col];
621 }
622 
623 static inline int32
624 get_partition_col_typmod(PartitionKey key, int col)
625 {
626  return key->parttypmod[col];
627 }
628 
629 /*
630  * RelationGetPartitionDesc
631  * Returns partition descriptor for a relation.
632  */
633 #define RelationGetPartitionDesc(relation) ((relation)->rd_partdesc)
634 
635 /* routines in utils/cache/relcache.c */
638 extern bool RelationHasUnloggedIndex(Relation rel);
639 extern List *RelationGetRepsetList(Relation rel);
640 
641 #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:255
Definition: fmgr.h:56
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
AttrNumber conkey[INDEX_MAX_KEYS]
Definition: rel.h:243
regproc RegProcedure
Definition: c.h:395
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:401
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:5980
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:256
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:597
static int16 get_partition_col_attnum(PartitionKey key, int col)
Definition: rel.h:612
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:267
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:381
Definition: rel.h:36
bool security_barrier
Definition: rel.h:339
Oid rd_pkindex
Definition: rel.h:137
int32 vl_len_
Definition: rel.h:338
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:603
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
struct PartitionKeyData PartitionKeyData
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:2136
static int32 get_partition_col_typmod(PartitionKey key, int col)
Definition: rel.h:624
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:618
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:591
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
Oid conpfeqop[INDEX_MAX_KEYS]
Definition: rel.h:245
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:340
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
AttrNumber confkey[INDEX_MAX_KEYS]
Definition: rel.h:244
int multixact_freeze_max_age
Definition: rel.h:269
Definition: c.h:439
void RelationIncrementReferenceCount(Relation rel)
Definition: relcache.c:2123
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:281
Oid relId
Definition: rel.h:38
AutoVacOpts autovacuum
Definition: rel.h:280