PostgreSQL Source Code  git master
pg_dump.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * pg_dump.h
4  * Common header file for the pg_dump utility
5  *
6  * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * src/bin/pg_dump/pg_dump.h
10  *
11  *-------------------------------------------------------------------------
12  */
13 
14 #ifndef PG_DUMP_H
15 #define PG_DUMP_H
16 
17 #include "pg_backup.h"
18 
19 
20 #define oidcmp(x,y) ( ((x) < (y) ? -1 : ((x) > (y)) ? 1 : 0) )
21 
22 /*
23  * The data structures used to store system catalog information. Every
24  * dumpable object is a subclass of DumpableObject.
25  *
26  * NOTE: the structures described here live for the entire pg_dump run;
27  * and in most cases we make a struct for every object we can find in the
28  * catalogs, not only those we are actually going to dump. Hence, it's
29  * best to store a minimal amount of per-object info in these structs,
30  * and retrieve additional per-object info when and if we dump a specific
31  * object. In particular, try to avoid retrieving expensive-to-compute
32  * information until it's known to be needed. We do, however, have to
33  * store enough info to determine whether an object should be dumped and
34  * what order to dump in.
35  */
36 
37 typedef enum
38 {
39  /* When modifying this enum, update priority tables in pg_dump_sort.c! */
61  DO_FK_CONSTRAINT, /* see note for ConstraintInfo */
87 
88 /*
89  * DumpComponents is a bitmask of the potentially dumpable components of
90  * a database object: its core definition, plus optional attributes such
91  * as ACL, comments, etc. The NONE and ALL symbols are convenient
92  * shorthands.
93  */
95 #define DUMP_COMPONENT_NONE (0)
96 #define DUMP_COMPONENT_DEFINITION (1 << 0)
97 #define DUMP_COMPONENT_DATA (1 << 1)
98 #define DUMP_COMPONENT_COMMENT (1 << 2)
99 #define DUMP_COMPONENT_SECLABEL (1 << 3)
100 #define DUMP_COMPONENT_ACL (1 << 4)
101 #define DUMP_COMPONENT_POLICY (1 << 5)
102 #define DUMP_COMPONENT_USERMAP (1 << 6)
103 #define DUMP_COMPONENT_ALL (0xFFFF)
104 
105 /*
106  * component types which require us to obtain a lock on the table
107  *
108  * Note that some components only require looking at the information
109  * in the pg_catalog tables and, for those components, we do not need
110  * to lock the table. Be careful here though- some components use
111  * server-side functions which pull the latest information from
112  * SysCache and in those cases we *do* need to lock the table.
113  *
114  * We do not need locks for the COMMENT and SECLABEL components as
115  * those simply query their associated tables without using any
116  * server-side functions. We do not need locks for the ACL component
117  * as we pull that information from pg_class without using any
118  * server-side functions that use SysCache. The USERMAP component
119  * is only relevant for FOREIGN SERVERs and not tables, so no sense
120  * locking a table for that either (that can happen if we are going
121  * to dump "ALL" components for a table).
122  *
123  * We DO need locks for DEFINITION, due to various server-side
124  * functions that are used and POLICY due to pg_get_expr(). We set
125  * this up to grab the lock except in the cases we know to be safe.
126  */
127 #define DUMP_COMPONENTS_REQUIRING_LOCK (\
128  DUMP_COMPONENT_DEFINITION |\
129  DUMP_COMPONENT_DATA |\
130  DUMP_COMPONENT_POLICY)
131 
132 typedef struct _dumpableObject
133 {
135  CatalogId catId; /* zero if not a cataloged object */
136  DumpId dumpId; /* assigned by AssignDumpId() */
137  char *name; /* object name (should never be NULL) */
138  struct _namespaceInfo *namespace; /* containing namespace, or NULL */
139  DumpComponents dump; /* bitmask of components requested to dump */
140  DumpComponents dump_contains; /* as above, but for contained objects */
141  DumpComponents components; /* bitmask of components available to dump */
142  bool ext_member; /* true if object is member of extension */
143  bool depends_on_ext; /* true if object depends on an extension */
144  DumpId *dependencies; /* dumpIds of objects this one depends on */
145  int nDeps; /* number of valid dependencies */
146  int allocDeps; /* allocated size of dependencies[] */
148 
149 /*
150  * Object types that have ACLs must store them in a DumpableAcl sub-struct,
151  * which must immediately follow the DumpableObject base struct.
152  */
153 typedef struct _dumpableAcl
154 {
155  char *acl; /* the object's actual ACL string */
156  char *acldefault; /* default ACL for the object's type & owner */
157  /* these fields come from the object's pg_init_privs entry, if any: */
158  char privtype; /* entry type, 'i' or 'e'; 0 if no entry */
159  char *initprivs; /* the object's initial ACL string, or NULL */
161 
162 /* Generic struct that can be used to access any object type having an ACL */
164 {
168 
169 typedef struct _namespaceInfo
170 {
173  bool create; /* CREATE SCHEMA, or just set owner? */
174  Oid nspowner; /* OID of owner */
175  const char *rolname; /* name of owner */
177 
178 typedef struct _extensionInfo
179 {
181  char *namespace; /* schema containing extension's objects */
183  char *extversion;
184  char *extconfig; /* info about configuration tables */
187 
188 typedef struct _typeInfo
189 {
192 
193  /*
194  * Note: dobj.name is the raw pg_type.typname entry. ftypname is the
195  * result of format_type(), which will be quoted if needed, and might be
196  * schema-qualified too.
197  */
198  char *ftypname;
199  const char *rolname;
202  char typrelkind; /* 'r', 'v', 'c', etc */
203  char typtype; /* 'b', 'c', etc */
204  bool isArray; /* true if auto-generated array type */
205  bool isMultirange; /* true if auto-generated multirange type */
206  bool isDefined; /* true if typisdefined */
207  /* If needed, we'll create a "shell type" entry for it; link that here: */
208  struct _shellTypeInfo *shellType; /* shell-type entry, or NULL */
209  /* If it's a domain, we store links to its constraints here: */
213 
214 typedef struct _shellTypeInfo
215 {
217 
218  TypeInfo *baseType; /* back link to associated base type */
220 
221 typedef struct _funcInfo
222 {
225  const char *rolname;
227  int nargs;
231 
232 /* AggInfo is a superset of FuncInfo */
233 typedef struct _aggInfo
234 {
236  /* we don't require any other fields at the moment */
238 
239 typedef struct _oprInfo
240 {
242  const char *rolname;
243  char oprkind;
246 
247 typedef struct _accessMethodInfo
248 {
250  char amtype;
251  char *amhandler;
253 
254 typedef struct _opclassInfo
255 {
257  const char *rolname;
259 
260 typedef struct _opfamilyInfo
261 {
263  const char *rolname;
265 
266 typedef struct _collInfo
267 {
269  const char *rolname;
271 
272 typedef struct _convInfo
273 {
275  const char *rolname;
277 
278 typedef struct _tableInfo
279 {
280  /*
281  * These fields are collected for every table in the database.
282  */
285  const char *rolname;
286  char relkind;
287  char relpersistence; /* relation persistence */
288  bool relispopulated; /* relation is populated */
289  char relreplident; /* replica identifier */
290  char *reltablespace; /* relation tablespace */
291  char *reloptions; /* options specified by WITH (...) */
292  char *checkoption; /* WITH CHECK OPTION, if any */
293  char *toast_reloptions; /* WITH options for the TOAST table */
294  bool hasindex; /* does it have any indexes? */
295  bool hasrules; /* does it have any rules? */
296  bool hastriggers; /* does it have any triggers? */
297  bool hascolumnACLs; /* do any columns have non-default ACLs? */
298  bool rowsec; /* is row security enabled? */
299  bool forcerowsec; /* is row security forced? */
300  bool hasoids; /* does it have OIDs? */
301  uint32 frozenxid; /* table's relfrozenxid */
302  uint32 minmxid; /* table's relminmxid */
303  Oid toast_oid; /* toast table's OID, or 0 if none */
304  uint32 toast_frozenxid; /* toast table's relfrozenxid, if any */
305  uint32 toast_minmxid; /* toast table's relminmxid */
306  int ncheck; /* # of CHECK expressions */
307  Oid reltype; /* OID of table's composite type, if any */
308  Oid reloftype; /* underlying type for typed table */
309  Oid foreign_server; /* foreign server oid, if applicable */
310  /* these two are set only if table is a sequence owned by a column: */
311  Oid owning_tab; /* OID of table owning sequence */
312  int owning_col; /* attr # of column owning sequence */
314  int relpages; /* table's size in pages (from pg_class) */
315  int toastpages; /* toast table's size in pages, if any */
316 
317  bool interesting; /* true if need to collect more data */
318  bool dummy_view; /* view's real definition must be postponed */
319  bool postponed_def; /* matview must be postponed into post-data */
320  bool ispartition; /* is table a partition? */
321 
322  /*
323  * These fields are computed only if we decide the table is interesting
324  * (it's either a table to dump, or a direct parent of a dumpable table).
325  */
326  int numatts; /* number of attributes */
327  char **attnames; /* the attribute names */
328  char **atttypnames; /* attribute type names */
329  int *atttypmod; /* type-specific type modifiers */
330  int *attstattarget; /* attribute statistics targets */
331  char *attstorage; /* attribute storage scheme */
332  char *typstorage; /* type storage scheme */
333  bool *attisdropped; /* true if attr is dropped; don't dump it */
334  char *attidentity;
336  int *attlen; /* attribute length, used by binary_upgrade */
337  char *attalign; /* attribute align, used by binary_upgrade */
338  bool *attislocal; /* true if attr has local definition */
339  char **attoptions; /* per-attribute options */
340  Oid *attcollation; /* per-attribute collation selection */
341  char *attcompression; /* per-attribute compression method */
342  char **attfdwoptions; /* per-attribute fdw options */
343  char **attmissingval; /* per attribute missing value */
344  bool *notnull; /* NOT NULL constraints on attributes */
345  bool *inhNotNull; /* true if NOT NULL is inherited */
346  struct _attrDefInfo **attrdefs; /* DEFAULT expressions */
347  struct _constraintInfo *checkexprs; /* CHECK constraints */
348  bool needs_override; /* has GENERATED ALWAYS AS IDENTITY */
349  char *amname; /* relation access method */
350 
351  /*
352  * Stuff computed only for dumpable tables.
353  */
354  int numParents; /* number of (immediate) parent tables */
355  struct _tableInfo **parents; /* TableInfos of immediate parents */
356  int numIndexes; /* number of indexes */
357  struct _indxInfo *indexes; /* indexes */
358  struct _tableDataInfo *dataObj; /* TableDataInfo, if dumping its data */
359  int numTriggers; /* number of triggers for table */
360  struct _triggerInfo *triggers; /* array of TriggerInfo structs */
362 
363 typedef struct _tableAttachInfo
364 {
366  TableInfo *parentTbl; /* link to partitioned table */
367  TableInfo *partitionTbl; /* link to partition */
369 
370 typedef struct _attrDefInfo
371 {
372  DumpableObject dobj; /* note: dobj.name is name of table */
373  TableInfo *adtable; /* link to table of attribute */
374  int adnum;
375  char *adef_expr; /* decompiled DEFAULT expression */
376  bool separate; /* true if must dump as separate item */
378 
379 typedef struct _tableDataInfo
380 {
382  TableInfo *tdtable; /* link to table to dump */
383  char *filtercond; /* WHERE condition to limit rows dumped */
385 
386 typedef struct _indxInfo
387 {
389  TableInfo *indextable; /* link to table the index is for */
390  char *indexdef;
391  char *tablespace; /* tablespace in which index is stored */
392  char *indreloptions; /* options specified by WITH (...) */
393  char *indstatcols; /* column numbers with statistics */
394  char *indstatvals; /* statistic values for columns */
395  int indnkeyattrs; /* number of index key attributes */
396  int indnattrs; /* total number of index attributes */
397  Oid *indkeys; /* In spite of the name 'indkeys' this field
398  * contains both key and nonkey attributes */
402  Oid parentidx; /* if a partition, parent index OID */
403  SimplePtrList partattaches; /* if partitioned, partition attach objects */
404 
405  /* if there is an associated constraint object, its dumpId: */
408 
409 typedef struct _indexAttachInfo
410 {
412  IndxInfo *parentIdx; /* link to index on partitioned table */
413  IndxInfo *partitionIdx; /* link to index on partition */
415 
416 typedef struct _statsExtInfo
417 {
419  const char *rolname;
420  int stattarget; /* statistics target */
422 
423 typedef struct _ruleInfo
424 {
426  TableInfo *ruletable; /* link to table the rule is for */
427  char ev_type;
430  bool separate; /* true if must dump as separate item */
431  /* separate is always true for non-ON SELECT rules */
433 
434 typedef struct _triggerInfo
435 {
437  TableInfo *tgtable; /* link to table the trigger is for */
438  char *tgfname;
439  int tgtype;
440  int tgnargs;
441  char *tgargs;
446  char tgenabled;
450  char *tgdef;
452 
453 typedef struct _evttriggerInfo
454 {
456  char *evtname;
457  char *evtevent;
458  const char *evtowner;
459  char *evttags;
460  char *evtfname;
463 
464 /*
465  * struct ConstraintInfo is used for all constraint types. However we
466  * use a different objType for foreign key constraints, to make it easier
467  * to sort them the way we want.
468  *
469  * Note: condeferrable and condeferred are currently only valid for
470  * unique/primary-key constraints. Otherwise that info is in condef.
471  */
472 typedef struct _constraintInfo
473 {
475  TableInfo *contable; /* NULL if domain constraint */
476  TypeInfo *condomain; /* NULL if table constraint */
477  char contype;
478  char *condef; /* definition, if CHECK or FOREIGN KEY */
479  Oid confrelid; /* referenced table, if FOREIGN KEY */
480  DumpId conindex; /* identifies associated index if any */
481  bool condeferrable; /* true if constraint is DEFERRABLE */
482  bool condeferred; /* true if constraint is INITIALLY DEFERRED */
483  bool conislocal; /* true if constraint has local definition */
484  bool separate; /* true if must dump as separate item */
486 
487 typedef struct _procLangInfo
488 {
495  const char *lanowner;
497 
498 typedef struct _castInfo
499 {
507 
508 typedef struct _transformInfo
509 {
516 
517 /* InhInfo isn't a DumpableObject, just temporary state */
518 typedef struct _inhInfo
519 {
520  Oid inhrelid; /* OID of a child table */
521  Oid inhparent; /* OID of its parent */
523 
524 typedef struct _prsInfo
525 {
533 
534 typedef struct _dictInfo
535 {
537  const char *rolname;
541 
542 typedef struct _tmplInfo
543 {
548 
549 typedef struct _cfgInfo
550 {
552  const char *rolname;
555 
556 typedef struct _fdwInfo
557 {
560  const char *rolname;
561  char *fdwhandler;
563  char *fdwoptions;
565 
566 typedef struct _foreignServerInfo
567 {
570  const char *rolname;
572  char *srvtype;
573  char *srvversion;
574  char *srvoptions;
576 
577 typedef struct _defaultACLInfo
578 {
581  const char *defaclrole;
584 
585 typedef struct _blobInfo
586 {
589  const char *rolname;
591 
592 /*
593  * The PolicyInfo struct is used to represent policies on a table and
594  * to indicate if a table has RLS enabled (ENABLE ROW SECURITY). If
595  * polname is NULL, then the record indicates ENABLE ROW SECURITY, while if
596  * it's non-NULL then this is a regular policy definition.
597  */
598 typedef struct _policyInfo
599 {
602  char *polname; /* null indicates RLS is enabled on rel */
603  char polcmd;
605  char *polroles;
606  char *polqual;
609 
610 /*
611  * The PublicationInfo struct is used to represent publications.
612  */
613 typedef struct _PublicationInfo
614 {
616  const char *rolname;
618  bool pubinsert;
619  bool pubupdate;
620  bool pubdelete;
624 
625 /*
626  * The PublicationRelInfo struct is used to represent publication table
627  * mapping.
628  */
629 typedef struct _PublicationRelInfo
630 {
634  char *pubrelqual;
635  char *pubrattrs;
637 
638 /*
639  * The PublicationSchemaInfo struct is used to represent publication schema
640  * mapping.
641  */
643 {
648 
649 /*
650  * The SubscriptionInfo struct is used to represent subscription.
651  */
652 typedef struct _SubscriptionInfo
653 {
655  const char *rolname;
656  char *subconninfo;
657  char *subslotname;
658  char *subbinary;
659  char *substream;
665 
666 /*
667  * common utility functions
668  */
669 
670 extern TableInfo *getSchemaData(Archive *fout, int *numTablesPtr);
671 
672 extern void AssignDumpId(DumpableObject *dobj);
673 extern DumpId createDumpId(void);
674 extern DumpId getMaxDumpId(void);
677 extern void getDumpableObjects(DumpableObject ***objs, int *numObjs);
678 
679 extern void addObjectDependency(DumpableObject *dobj, DumpId refId);
680 extern void removeObjectDependency(DumpableObject *dobj, DumpId refId);
681 
682 extern TableInfo *findTableByOid(Oid oid);
683 extern TypeInfo *findTypeByOid(Oid oid);
684 extern FuncInfo *findFuncByOid(Oid oid);
685 extern OprInfo *findOprByOid(Oid oid);
686 extern CollInfo *findCollationByOid(Oid oid);
690 
691 extern void recordExtensionMembership(CatalogId catId, ExtensionInfo *ext);
692 extern ExtensionInfo *findOwningExtension(CatalogId catalogId);
693 
694 extern void parseOidArray(const char *str, Oid *array, int arraysize);
695 
696 extern void sortDumpableObjects(DumpableObject **objs, int numObjs,
697  DumpId preBoundaryId, DumpId postBoundaryId);
698 extern void sortDumpableObjectsByTypeName(DumpableObject **objs, int numObjs);
699 
700 /*
701  * version specific routines
702  */
703 extern NamespaceInfo *getNamespaces(Archive *fout, int *numNamespaces);
704 extern ExtensionInfo *getExtensions(Archive *fout, int *numExtensions);
705 extern TypeInfo *getTypes(Archive *fout, int *numTypes);
706 extern FuncInfo *getFuncs(Archive *fout, int *numFuncs);
707 extern AggInfo *getAggregates(Archive *fout, int *numAggregates);
708 extern OprInfo *getOperators(Archive *fout, int *numOperators);
709 extern AccessMethodInfo *getAccessMethods(Archive *fout, int *numAccessMethods);
710 extern OpclassInfo *getOpclasses(Archive *fout, int *numOpclasses);
711 extern OpfamilyInfo *getOpfamilies(Archive *fout, int *numOpfamilies);
712 extern CollInfo *getCollations(Archive *fout, int *numCollations);
713 extern ConvInfo *getConversions(Archive *fout, int *numConversions);
714 extern TableInfo *getTables(Archive *fout, int *numTables);
715 extern void getOwnedSeqs(Archive *fout, TableInfo tblinfo[], int numTables);
716 extern InhInfo *getInherits(Archive *fout, int *numInherits);
717 extern void getIndexes(Archive *fout, TableInfo tblinfo[], int numTables);
718 extern void getExtendedStatistics(Archive *fout);
719 extern void getConstraints(Archive *fout, TableInfo tblinfo[], int numTables);
720 extern RuleInfo *getRules(Archive *fout, int *numRules);
721 extern void getTriggers(Archive *fout, TableInfo tblinfo[], int numTables);
722 extern ProcLangInfo *getProcLangs(Archive *fout, int *numProcLangs);
723 extern CastInfo *getCasts(Archive *fout, int *numCasts);
724 extern TransformInfo *getTransforms(Archive *fout, int *numTransforms);
725 extern void getTableAttrs(Archive *fout, TableInfo *tbinfo, int numTables);
726 extern bool shouldPrintColumn(const DumpOptions *dopt, const TableInfo *tbinfo, int colno);
727 extern TSParserInfo *getTSParsers(Archive *fout, int *numTSParsers);
728 extern TSDictInfo *getTSDictionaries(Archive *fout, int *numTSDicts);
729 extern TSTemplateInfo *getTSTemplates(Archive *fout, int *numTSTemplates);
730 extern TSConfigInfo *getTSConfigurations(Archive *fout, int *numTSConfigs);
732  int *numForeignDataWrappers);
734  int *numForeignServers);
735 extern DefaultACLInfo *getDefaultACLs(Archive *fout, int *numDefaultACLs);
736 extern void getExtensionMembership(Archive *fout, ExtensionInfo extinfo[],
737  int numExtensions);
738 extern void processExtensionTables(Archive *fout, ExtensionInfo extinfo[],
739  int numExtensions);
740 extern EventTriggerInfo *getEventTriggers(Archive *fout, int *numEventTriggers);
741 extern void getPolicies(Archive *fout, TableInfo tblinfo[], int numTables);
743  int *numPublications);
744 extern void getPublicationNamespaces(Archive *fout);
745 extern void getPublicationTables(Archive *fout, TableInfo tblinfo[],
746  int numTables);
747 extern void getSubscriptions(Archive *fout);
748 
749 #endif /* PG_DUMP_H */
unsigned int uint32
Definition: c.h:452
int DumpId
Definition: pg_backup.h:265
NamespaceInfo * getNamespaces(Archive *fout, int *numNamespaces)
Definition: pg_dump.c:4966
void getConstraints(Archive *fout, TableInfo tblinfo[], int numTables)
Definition: pg_dump.c:7017
struct _collInfo CollInfo
struct _transformInfo TransformInfo
void recordExtensionMembership(CatalogId catId, ExtensionInfo *ext)
Definition: common.c:931
void getPublicationNamespaces(Archive *fout)
Definition: pg_dump.c:4055
struct _opfamilyInfo OpfamilyInfo
struct _indxInfo IndxInfo
DefaultACLInfo * getDefaultACLs(Archive *fout, int *numDefaultACLs)
Definition: pg_dump.c:9101
struct _fdwInfo FdwInfo
struct _triggerInfo TriggerInfo
struct _tmplInfo TSTemplateInfo
struct _tableInfo TableInfo
FuncInfo * findFuncByOid(Oid oid)
Definition: common.c:822
struct _aggInfo AggInfo
void getPolicies(Archive *fout, TableInfo tblinfo[], int numTables)
Definition: pg_dump.c:3570
struct _castInfo CastInfo
void getExtensionMembership(Archive *fout, ExtensionInfo extinfo[], int numExtensions)
Definition: pg_dump.c:17368
struct _tableDataInfo TableDataInfo
ForeignServerInfo * getForeignServers(Archive *fout, int *numForeignServers)
Definition: pg_dump.c:9007
NamespaceInfo * findNamespaceByOid(Oid oid)
Definition: common.c:876
struct _cfgInfo TSConfigInfo
AccessMethodInfo * getAccessMethods(Archive *fout, int *numAccessMethods)
Definition: pg_dump.c:5557
FdwInfo * getForeignDataWrappers(Archive *fout, int *numForeignDataWrappers)
Definition: pg_dump.c:8917
FuncInfo * getFuncs(Archive *fout, int *numFuncs)
Definition: pg_dump.c:5908
TSConfigInfo * getTSConfigurations(Archive *fout, int *numTSConfigs)
Definition: pg_dump.c:8852
struct _dumpableObject DumpableObject
struct _accessMethodInfo AccessMethodInfo
struct _attrDefInfo AttrDefInfo
ConvInfo * getConversions(Archive *fout, int *numConversions)
Definition: pg_dump.c:5489
void getOwnedSeqs(Archive *fout, TableInfo tblinfo[], int numTables)
Definition: pg_dump.c:6526
ExtensionInfo * findOwningExtension(CatalogId catalogId)
Definition: common.c:955
TableInfo * getSchemaData(Archive *fout, int *numTablesPtr)
Definition: common.c:97
struct _ruleInfo RuleInfo
void getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
Definition: pg_dump.c:4142
DumpableObject * findObjectByCatalogId(CatalogId catalogId)
Definition: common.c:679
void getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
Definition: pg_dump.c:6635
void addObjectDependency(DumpableObject *dobj, DumpId refId)
Definition: common.c:720
struct _foreignServerInfo ForeignServerInfo
DumpableObject * findObjectByDumpId(DumpId dumpId)
Definition: common.c:666
void parseOidArray(const char *str, Oid *array, int arraysize)
Definition: common.c:1026
struct _inhInfo InhInfo
struct _indexAttachInfo IndexAttachInfo
struct _procLangInfo ProcLangInfo
TSDictInfo * getTSDictionaries(Archive *fout, int *numTSDicts)
Definition: pg_dump.c:8715
InhInfo * getInherits(Archive *fout, int *numInherits)
Definition: pg_dump.c:6589
OpfamilyInfo * getOpfamilies(Archive *fout, int *numOpfamilies)
Definition: pg_dump.c:5694
struct _prsInfo TSParserInfo
struct _policyInfo PolicyInfo
TableInfo * findTableByOid(Oid oid)
Definition: common.c:767
struct _PublicationInfo PublicationInfo
struct _namespaceInfo NamespaceInfo
struct _shellTypeInfo ShellTypeInfo
struct _dumpableObjectWithAcl DumpableObjectWithAcl
struct _defaultACLInfo DefaultACLInfo
PublicationInfo * getPublications(Archive *fout, int *numPublications)
Definition: pg_dump.c:3855
DumpId createDumpId(void)
Definition: common.c:646
TSTemplateInfo * getTSTemplates(Archive *fout, int *numTSTemplates)
Definition: pg_dump.c:8787
ProcLangInfo * getProcLangs(Archive *fout, int *numProcLangs)
Definition: pg_dump.c:7755
TypeInfo * getTypes(Archive *fout, int *numTypes)
Definition: pg_dump.c:5177
ExtensionInfo * findExtensionByOid(Oid oid)
Definition: common.c:894
void AssignDumpId(DumpableObject *dobj)
Definition: common.c:580
struct _evttriggerInfo EventTriggerInfo
void getExtendedStatistics(Archive *fout)
Definition: pg_dump.c:6945
struct _dumpableAcl DumpableAcl
void processExtensionTables(Archive *fout, ExtensionInfo extinfo[], int numExtensions)
Definition: pg_dump.c:17461
DumpId getMaxDumpId(void)
Definition: common.c:655
OprInfo * getOperators(Archive *fout, int *numOperators)
Definition: pg_dump.c:5347
OpclassInfo * getOpclasses(Archive *fout, int *numOpclasses)
Definition: pg_dump.c:5628
uint32 DumpComponents
Definition: pg_dump.h:94
CollInfo * getCollations(Archive *fout, int *numCollations)
Definition: pg_dump.c:5421
struct _typeInfo TypeInfo
void getSubscriptions(Archive *fout)
Definition: pg_dump.c:4396
void sortDumpableObjects(DumpableObject **objs, int numObjs, DumpId preBoundaryId, DumpId postBoundaryId)
Definition: pg_dump_sort.c:319
struct _SubscriptionInfo SubscriptionInfo
struct _extensionInfo ExtensionInfo
struct _dictInfo TSDictInfo
struct _funcInfo FuncInfo
struct _opclassInfo OpclassInfo
struct _blobInfo BlobInfo
ExtensionInfo * getExtensions(Archive *fout, int *numExtensions)
Definition: pg_dump.c:5102
void getDumpableObjects(DumpableObject ***objs, int *numObjs)
Definition: common.c:698
struct _statsExtInfo StatsExtInfo
CollInfo * findCollationByOid(Oid oid)
Definition: common.c:858
TSParserInfo * getTSParsers(Archive *fout, int *numTSParsers)
Definition: pg_dump.c:8635
TransformInfo * getTransforms(Archive *fout, int *numTransforms)
Definition: pg_dump.c:7961
void getTriggers(Archive *fout, TableInfo tblinfo[], int numTables)
Definition: pg_dump.c:7398
DumpableObjectType
Definition: pg_dump.h:38
@ DO_EVENT_TRIGGER
Definition: pg_dump.h:79
@ DO_REFRESH_MATVIEW
Definition: pg_dump.h:80
@ DO_POLICY
Definition: pg_dump.h:81
@ DO_CAST
Definition: pg_dump.h:63
@ DO_FOREIGN_SERVER
Definition: pg_dump.h:72
@ DO_PRE_DATA_BOUNDARY
Definition: pg_dump.h:77
@ DO_PROCLANG
Definition: pg_dump.h:62
@ DO_TYPE
Definition: pg_dump.h:42
@ DO_INDEX
Definition: pg_dump.h:55
@ DO_COLLATION
Definition: pg_dump.h:50
@ DO_BLOB
Definition: pg_dump.h:75
@ DO_TSCONFIG
Definition: pg_dump.h:70
@ DO_OPERATOR
Definition: pg_dump.h:46
@ DO_FK_CONSTRAINT
Definition: pg_dump.h:61
@ DO_CONSTRAINT
Definition: pg_dump.h:60
@ DO_SUBSCRIPTION
Definition: pg_dump.h:85
@ DO_DEFAULT_ACL
Definition: pg_dump.h:73
@ DO_FDW
Definition: pg_dump.h:71
@ DO_SEQUENCE_SET
Definition: pg_dump.h:65
@ DO_ATTRDEF
Definition: pg_dump.h:54
@ DO_BLOB_DATA
Definition: pg_dump.h:76
@ DO_PUBLICATION_REL
Definition: pg_dump.h:83
@ DO_TABLE_ATTACH
Definition: pg_dump.h:53
@ DO_OPCLASS
Definition: pg_dump.h:48
@ DO_INDEX_ATTACH
Definition: pg_dump.h:56
@ DO_TSTEMPLATE
Definition: pg_dump.h:69
@ DO_STATSEXT
Definition: pg_dump.h:57
@ DO_FUNC
Definition: pg_dump.h:44
@ DO_POST_DATA_BOUNDARY
Definition: pg_dump.h:78
@ DO_OPFAMILY
Definition: pg_dump.h:49
@ DO_TRANSFORM
Definition: pg_dump.h:74
@ DO_ACCESS_METHOD
Definition: pg_dump.h:47
@ DO_PUBLICATION_TABLE_IN_SCHEMA
Definition: pg_dump.h:84
@ DO_CONVERSION
Definition: pg_dump.h:51
@ DO_TRIGGER
Definition: pg_dump.h:59
@ DO_RULE
Definition: pg_dump.h:58
@ DO_DUMMY_TYPE
Definition: pg_dump.h:66
@ DO_TSDICT
Definition: pg_dump.h:68
@ DO_TSPARSER
Definition: pg_dump.h:67
@ DO_EXTENSION
Definition: pg_dump.h:41
@ DO_TABLE_DATA
Definition: pg_dump.h:64
@ DO_PUBLICATION
Definition: pg_dump.h:82
@ DO_TABLE
Definition: pg_dump.h:52
@ DO_NAMESPACE
Definition: pg_dump.h:40
@ DO_AGG
Definition: pg_dump.h:45
@ DO_SHELL_TYPE
Definition: pg_dump.h:43
TypeInfo * findTypeByOid(Oid oid)
Definition: common.c:803
RuleInfo * getRules(Archive *fout, int *numRules)
Definition: pg_dump.c:7297
OprInfo * findOprByOid(Oid oid)
Definition: common.c:840
struct _PublicationRelInfo PublicationRelInfo
void sortDumpableObjectsByTypeName(DumpableObject **objs, int numObjs)
Definition: pg_dump_sort.c:186
AggInfo * getAggregates(Archive *fout, int *numAggregates)
Definition: pg_dump.c:5762
struct _convInfo ConvInfo
EventTriggerInfo * getEventTriggers(Archive *fout, int *numEventTriggers)
Definition: pg_dump.c:7668
struct _constraintInfo ConstraintInfo
TableInfo * getTables(Archive *fout, int *numTables)
Definition: pg_dump.c:6106
bool shouldPrintColumn(const DumpOptions *dopt, const TableInfo *tbinfo, int colno)
Definition: pg_dump.c:8617
struct _tableAttachInfo TableAttachInfo
void removeObjectDependency(DumpableObject *dobj, DumpId refId)
Definition: common.c:747
void getTableAttrs(Archive *fout, TableInfo *tbinfo, int numTables)
Definition: pg_dump.c:8052
CastInfo * getCasts(Archive *fout, int *numCasts)
Definition: pg_dump.c:7845
struct _oprInfo OprInfo
PublicationInfo * findPublicationByOid(Oid oid)
Definition: common.c:912
struct _PublicationSchemaInfo PublicationSchemaInfo
unsigned int Oid
Definition: postgres_ext.h:31
const char * rolname
Definition: pg_dump.h:616
bool puballtables
Definition: pg_dump.h:617
bool pubtruncate
Definition: pg_dump.h:621
DumpableObject dobj
Definition: pg_dump.h:615
TableInfo * pubtable
Definition: pg_dump.h:633
PublicationInfo * publication
Definition: pg_dump.h:632
DumpableObject dobj
Definition: pg_dump.h:631
NamespaceInfo * pubschema
Definition: pg_dump.h:646
DumpableObject dobj
Definition: pg_dump.h:644
PublicationInfo * publication
Definition: pg_dump.h:645
char * subbinary
Definition: pg_dump.h:658
const char * rolname
Definition: pg_dump.h:655
char * subsynccommit
Definition: pg_dump.h:662
char * subpublications
Definition: pg_dump.h:663
char * subtwophasestate
Definition: pg_dump.h:660
char * substream
Definition: pg_dump.h:659
char * subslotname
Definition: pg_dump.h:657
char * subdisableonerr
Definition: pg_dump.h:661
char * subconninfo
Definition: pg_dump.h:656
DumpableObject dobj
Definition: pg_dump.h:654
char * amhandler
Definition: pg_dump.h:251
DumpableObject dobj
Definition: pg_dump.h:249
FuncInfo aggfn
Definition: pg_dump.h:235
DumpableObject dobj
Definition: pg_dump.h:372
char * adef_expr
Definition: pg_dump.h:375
TableInfo * adtable
Definition: pg_dump.h:373
bool separate
Definition: pg_dump.h:376
DumpableObject dobj
Definition: pg_dump.h:587
const char * rolname
Definition: pg_dump.h:589
DumpableAcl dacl
Definition: pg_dump.h:588
char castmethod
Definition: pg_dump.h:505
Oid casttarget
Definition: pg_dump.h:502
char castcontext
Definition: pg_dump.h:504
DumpableObject dobj
Definition: pg_dump.h:500
Oid castsource
Definition: pg_dump.h:501
Oid castfunc
Definition: pg_dump.h:503
Oid cfgparser
Definition: pg_dump.h:553
DumpableObject dobj
Definition: pg_dump.h:551
const char * rolname
Definition: pg_dump.h:552
const char * rolname
Definition: pg_dump.h:269
DumpableObject dobj
Definition: pg_dump.h:268
TypeInfo * condomain
Definition: pg_dump.h:476
TableInfo * contable
Definition: pg_dump.h:475
bool condeferred
Definition: pg_dump.h:482
bool conislocal
Definition: pg_dump.h:483
DumpableObject dobj
Definition: pg_dump.h:474
DumpId conindex
Definition: pg_dump.h:480
bool condeferrable
Definition: pg_dump.h:481
char * condef
Definition: pg_dump.h:478
DumpableObject dobj
Definition: pg_dump.h:274
const char * rolname
Definition: pg_dump.h:275
DumpableObject dobj
Definition: pg_dump.h:579
DumpableAcl dacl
Definition: pg_dump.h:580
const char * defaclrole
Definition: pg_dump.h:581
char defaclobjtype
Definition: pg_dump.h:582
char * dictinitoption
Definition: pg_dump.h:539
DumpableObject dobj
Definition: pg_dump.h:536
const char * rolname
Definition: pg_dump.h:537
Oid dicttemplate
Definition: pg_dump.h:538
char privtype
Definition: pg_dump.h:158
char * acldefault
Definition: pg_dump.h:156
char * acl
Definition: pg_dump.h:155
char * initprivs
Definition: pg_dump.h:159
DumpableAcl dacl
Definition: pg_dump.h:166
DumpableObject dobj
Definition: pg_dump.h:165
DumpComponents dump
Definition: pg_dump.h:138
char * name
Definition: pg_dump.h:137
DumpId * dependencies
Definition: pg_dump.h:144
DumpId dumpId
Definition: pg_dump.h:136
bool ext_member
Definition: pg_dump.h:142
DumpComponents components
Definition: pg_dump.h:141
DumpableObjectType objType
Definition: pg_dump.h:134
CatalogId catId
Definition: pg_dump.h:135
DumpComponents dump_contains
Definition: pg_dump.h:140
bool depends_on_ext
Definition: pg_dump.h:143
char * evtevent
Definition: pg_dump.h:457
char * evtfname
Definition: pg_dump.h:460
char evtenabled
Definition: pg_dump.h:461
char * evtname
Definition: pg_dump.h:456
const char * evtowner
Definition: pg_dump.h:458
char * evttags
Definition: pg_dump.h:459
DumpableObject dobj
Definition: pg_dump.h:455
bool relocatable
Definition: pg_dump.h:181
char * extversion
Definition: pg_dump.h:183
DumpableObject dobj
Definition: pg_dump.h:180
char * extcondition
Definition: pg_dump.h:185
char * extconfig
Definition: pg_dump.h:184
char * fdwhandler
Definition: pg_dump.h:561
const char * rolname
Definition: pg_dump.h:560
char * fdwvalidator
Definition: pg_dump.h:562
char * fdwoptions
Definition: pg_dump.h:563
DumpableAcl dacl
Definition: pg_dump.h:559
DumpableObject dobj
Definition: pg_dump.h:558
DumpableAcl dacl
Definition: pg_dump.h:569
char * srvoptions
Definition: pg_dump.h:574
DumpableObject dobj
Definition: pg_dump.h:568
const char * rolname
Definition: pg_dump.h:570
char * srvversion
Definition: pg_dump.h:573
Oid lang
Definition: pg_dump.h:226
const char * rolname
Definition: pg_dump.h:225
Oid * argtypes
Definition: pg_dump.h:228
Oid prorettype
Definition: pg_dump.h:229
DumpableObject dobj
Definition: pg_dump.h:223
int nargs
Definition: pg_dump.h:227
DumpableAcl dacl
Definition: pg_dump.h:224
IndxInfo * partitionIdx
Definition: pg_dump.h:413
DumpableObject dobj
Definition: pg_dump.h:411
IndxInfo * parentIdx
Definition: pg_dump.h:412
bool indisreplident
Definition: pg_dump.h:400
int indnkeyattrs
Definition: pg_dump.h:395
char * indstatvals
Definition: pg_dump.h:394
char * indstatcols
Definition: pg_dump.h:393
int indnattrs
Definition: pg_dump.h:396
TableInfo * indextable
Definition: pg_dump.h:389
Oid parentidx
Definition: pg_dump.h:402
Oid * indkeys
Definition: pg_dump.h:397
char * indreloptions
Definition: pg_dump.h:392
DumpId indexconstraint
Definition: pg_dump.h:406
bool indisclustered
Definition: pg_dump.h:399
SimplePtrList partattaches
Definition: pg_dump.h:403
char * tablespace
Definition: pg_dump.h:391
bool indnullsnotdistinct
Definition: pg_dump.h:401
char * indexdef
Definition: pg_dump.h:390
DumpableObject dobj
Definition: pg_dump.h:388
Oid inhparent
Definition: pg_dump.h:521
Oid inhrelid
Definition: pg_dump.h:520
DumpableObject dobj
Definition: pg_dump.h:171
DumpableAcl dacl
Definition: pg_dump.h:172
const char * rolname
Definition: pg_dump.h:175
DumpableObject dobj
Definition: pg_dump.h:256
const char * rolname
Definition: pg_dump.h:257
const char * rolname
Definition: pg_dump.h:263
DumpableObject dobj
Definition: pg_dump.h:262
DumpableObject dobj
Definition: pg_dump.h:241
char oprkind
Definition: pg_dump.h:243
Oid oprcode
Definition: pg_dump.h:244
const char * rolname
Definition: pg_dump.h:242
TableInfo * poltable
Definition: pg_dump.h:601
char * polqual
Definition: pg_dump.h:606
char polcmd
Definition: pg_dump.h:603
char * polroles
Definition: pg_dump.h:605
char * polwithcheck
Definition: pg_dump.h:607
DumpableObject dobj
Definition: pg_dump.h:600
bool polpermissive
Definition: pg_dump.h:604
char * polname
Definition: pg_dump.h:602
Oid lanvalidator
Definition: pg_dump.h:494
DumpableAcl dacl
Definition: pg_dump.h:490
DumpableObject dobj
Definition: pg_dump.h:489
Oid laninline
Definition: pg_dump.h:493
const char * lanowner
Definition: pg_dump.h:495
Oid lanplcallfoid
Definition: pg_dump.h:492
bool lanpltrusted
Definition: pg_dump.h:491
DumpableObject dobj
Definition: pg_dump.h:526
Oid prstoken
Definition: pg_dump.h:528
Oid prslextype
Definition: pg_dump.h:531
Oid prsheadline
Definition: pg_dump.h:530
Oid prsstart
Definition: pg_dump.h:527
Oid prsend
Definition: pg_dump.h:529
DumpableObject dobj
Definition: pg_dump.h:425
bool separate
Definition: pg_dump.h:430
char ev_enabled
Definition: pg_dump.h:429
bool is_instead
Definition: pg_dump.h:428
TableInfo * ruletable
Definition: pg_dump.h:426
char ev_type
Definition: pg_dump.h:427
TypeInfo * baseType
Definition: pg_dump.h:218
DumpableObject dobj
Definition: pg_dump.h:216
int stattarget
Definition: pg_dump.h:420
const char * rolname
Definition: pg_dump.h:419
DumpableObject dobj
Definition: pg_dump.h:418
TableInfo * partitionTbl
Definition: pg_dump.h:367
DumpableObject dobj
Definition: pg_dump.h:365
TableInfo * parentTbl
Definition: pg_dump.h:366
TableInfo * tdtable
Definition: pg_dump.h:382
DumpableObject dobj
Definition: pg_dump.h:381
char * filtercond
Definition: pg_dump.h:383
char * attidentity
Definition: pg_dump.h:334
char * reltablespace
Definition: pg_dump.h:290
int ncheck
Definition: pg_dump.h:306
bool ispartition
Definition: pg_dump.h:320
struct _indxInfo * indexes
Definition: pg_dump.h:357
bool * attislocal
Definition: pg_dump.h:338
DumpableObject dobj
Definition: pg_dump.h:283
bool is_identity_sequence
Definition: pg_dump.h:313
Oid reloftype
Definition: pg_dump.h:308
int numParents
Definition: pg_dump.h:354
bool interesting
Definition: pg_dump.h:317
char * toast_reloptions
Definition: pg_dump.h:293
struct _tableInfo ** parents
Definition: pg_dump.h:355
DumpableAcl dacl
Definition: pg_dump.h:284
bool relispopulated
Definition: pg_dump.h:288
char * attgenerated
Definition: pg_dump.h:335
int * attlen
Definition: pg_dump.h:336
Oid reltype
Definition: pg_dump.h:307
char ** attfdwoptions
Definition: pg_dump.h:342
bool hasoids
Definition: pg_dump.h:300
Oid toast_oid
Definition: pg_dump.h:303
Oid foreign_server
Definition: pg_dump.h:309
bool hasrules
Definition: pg_dump.h:295
struct _triggerInfo * triggers
Definition: pg_dump.h:360
bool * attisdropped
Definition: pg_dump.h:333
bool needs_override
Definition: pg_dump.h:348
struct _constraintInfo * checkexprs
Definition: pg_dump.h:347
int * attstattarget
Definition: pg_dump.h:330
uint32 frozenxid
Definition: pg_dump.h:301
char * typstorage
Definition: pg_dump.h:332
int owning_col
Definition: pg_dump.h:312
char * checkoption
Definition: pg_dump.h:292
int numatts
Definition: pg_dump.h:326
bool hastriggers
Definition: pg_dump.h:296
const char * rolname
Definition: pg_dump.h:285
struct _attrDefInfo ** attrdefs
Definition: pg_dump.h:346
char ** attoptions
Definition: pg_dump.h:339
char relreplident
Definition: pg_dump.h:289
int numTriggers
Definition: pg_dump.h:359
uint32 minmxid
Definition: pg_dump.h:302
Oid * attcollation
Definition: pg_dump.h:340
char * attstorage
Definition: pg_dump.h:331
int toastpages
Definition: pg_dump.h:315
bool * notnull
Definition: pg_dump.h:344
Oid owning_tab
Definition: pg_dump.h:311
struct _tableDataInfo * dataObj
Definition: pg_dump.h:358
char * amname
Definition: pg_dump.h:349
bool dummy_view
Definition: pg_dump.h:318
bool forcerowsec
Definition: pg_dump.h:299
bool hascolumnACLs
Definition: pg_dump.h:297
char ** atttypnames
Definition: pg_dump.h:328
char ** attmissingval
Definition: pg_dump.h:343
char relpersistence
Definition: pg_dump.h:287
char ** attnames
Definition: pg_dump.h:327
char relkind
Definition: pg_dump.h:286
bool hasindex
Definition: pg_dump.h:294
char * reloptions
Definition: pg_dump.h:291
int numIndexes
Definition: pg_dump.h:356
int relpages
Definition: pg_dump.h:314
uint32 toast_frozenxid
Definition: pg_dump.h:304
uint32 toast_minmxid
Definition: pg_dump.h:305
char * attalign
Definition: pg_dump.h:337
char * attcompression
Definition: pg_dump.h:341
int * atttypmod
Definition: pg_dump.h:329
bool postponed_def
Definition: pg_dump.h:319
bool rowsec
Definition: pg_dump.h:298
bool * inhNotNull
Definition: pg_dump.h:345
Oid tmpllexize
Definition: pg_dump.h:546
Oid tmplinit
Definition: pg_dump.h:545
DumpableObject dobj
Definition: pg_dump.h:544
DumpableObject dobj
Definition: pg_dump.h:510
Oid trffromsql
Definition: pg_dump.h:513
int tgtype
Definition: pg_dump.h:439
TableInfo * tgtable
Definition: pg_dump.h:437
bool tgdeferrable
Definition: pg_dump.h:448
DumpableObject dobj
Definition: pg_dump.h:436
char * tgconstrname
Definition: pg_dump.h:443
int tgnargs
Definition: pg_dump.h:440
char tgenabled
Definition: pg_dump.h:446
Oid tgconstrrelid
Definition: pg_dump.h:444
char * tgdef
Definition: pg_dump.h:450
char * tgfname
Definition: pg_dump.h:438
bool tgispartition
Definition: pg_dump.h:447
char * tgargs
Definition: pg_dump.h:441
bool tgisconstraint
Definition: pg_dump.h:442
bool tginitdeferred
Definition: pg_dump.h:449
char * tgconstrrelname
Definition: pg_dump.h:445
bool isMultirange
Definition: pg_dump.h:205
struct _constraintInfo * domChecks
Definition: pg_dump.h:211
DumpableAcl dacl
Definition: pg_dump.h:191
DumpableObject dobj
Definition: pg_dump.h:190
bool isDefined
Definition: pg_dump.h:206
char * ftypname
Definition: pg_dump.h:198
char typrelkind
Definition: pg_dump.h:202
Oid typelem
Definition: pg_dump.h:200
struct _shellTypeInfo * shellType
Definition: pg_dump.h:208
int nDomChecks
Definition: pg_dump.h:210
char typtype
Definition: pg_dump.h:203
const char * rolname
Definition: pg_dump.h:199
Oid typrelid
Definition: pg_dump.h:201
bool isArray
Definition: pg_dump.h:204