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-2023, 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;
230  bool postponed_def; /* function must be postponed into post-data */
232 
233 /* AggInfo is a superset of FuncInfo */
234 typedef struct _aggInfo
235 {
237  /* we don't require any other fields at the moment */
239 
240 typedef struct _oprInfo
241 {
243  const char *rolname;
244  char oprkind;
247 
248 typedef struct _accessMethodInfo
249 {
251  char amtype;
252  char *amhandler;
254 
255 typedef struct _opclassInfo
256 {
258  const char *rolname;
260 
261 typedef struct _opfamilyInfo
262 {
264  const char *rolname;
266 
267 typedef struct _collInfo
268 {
270  const char *rolname;
272 
273 typedef struct _convInfo
274 {
276  const char *rolname;
278 
279 typedef struct _tableInfo
280 {
281  /*
282  * These fields are collected for every table in the database.
283  */
286  const char *rolname;
287  char relkind;
288  char relpersistence; /* relation persistence */
289  bool relispopulated; /* relation is populated */
290  char relreplident; /* replica identifier */
291  char *reltablespace; /* relation tablespace */
292  char *reloptions; /* options specified by WITH (...) */
293  char *checkoption; /* WITH CHECK OPTION, if any */
294  char *toast_reloptions; /* WITH options for the TOAST table */
295  bool hasindex; /* does it have any indexes? */
296  bool hasrules; /* does it have any rules? */
297  bool hastriggers; /* does it have any triggers? */
298  bool hascolumnACLs; /* do any columns have non-default ACLs? */
299  bool rowsec; /* is row security enabled? */
300  bool forcerowsec; /* is row security forced? */
301  bool hasoids; /* does it have OIDs? */
302  uint32 frozenxid; /* table's relfrozenxid */
303  uint32 minmxid; /* table's relminmxid */
304  Oid toast_oid; /* toast table's OID, or 0 if none */
305  uint32 toast_frozenxid; /* toast table's relfrozenxid, if any */
306  uint32 toast_minmxid; /* toast table's relminmxid */
307  int ncheck; /* # of CHECK expressions */
308  Oid reltype; /* OID of table's composite type, if any */
309  Oid reloftype; /* underlying type for typed table */
310  Oid foreign_server; /* foreign server oid, if applicable */
311  /* these two are set only if table is a sequence owned by a column: */
312  Oid owning_tab; /* OID of table owning sequence */
313  int owning_col; /* attr # of column owning sequence */
315  int relpages; /* table's size in pages (from pg_class) */
316  int toastpages; /* toast table's size in pages, if any */
317 
318  bool interesting; /* true if need to collect more data */
319  bool dummy_view; /* view's real definition must be postponed */
320  bool postponed_def; /* matview must be postponed into post-data */
321  bool ispartition; /* is table a partition? */
322  bool unsafe_partitions; /* is it an unsafe partitioned table? */
323 
324  int numParents; /* number of (immediate) parent tables */
325  struct _tableInfo **parents; /* TableInfos of immediate parents */
326 
327  /*
328  * These fields are computed only if we decide the table is interesting
329  * (it's either a table to dump, or a direct parent of a dumpable table).
330  */
331  int numatts; /* number of attributes */
332  char **attnames; /* the attribute names */
333  char **atttypnames; /* attribute type names */
334  int *attstattarget; /* attribute statistics targets */
335  char *attstorage; /* attribute storage scheme */
336  char *typstorage; /* type storage scheme */
337  bool *attisdropped; /* true if attr is dropped; don't dump it */
338  char *attidentity;
340  int *attlen; /* attribute length, used by binary_upgrade */
341  char *attalign; /* attribute align, used by binary_upgrade */
342  bool *attislocal; /* true if attr has local definition */
343  char **attoptions; /* per-attribute options */
344  Oid *attcollation; /* per-attribute collation selection */
345  char *attcompression; /* per-attribute compression method */
346  char **attfdwoptions; /* per-attribute fdw options */
347  char **attmissingval; /* per attribute missing value */
348  char **notnull_constrs; /* NOT NULL constraint names. If null,
349  * there isn't one on this column. If
350  * empty string, unnamed constraint
351  * (pre-v17) */
352  bool *notnull_noinh; /* NOT NULL is NO INHERIT */
353  bool *notnull_throwaway; /* drop the NOT NULL constraint later */
354  bool *notnull_inh; /* true if NOT NULL has no local definition */
355  struct _attrDefInfo **attrdefs; /* DEFAULT expressions */
356  struct _constraintInfo *checkexprs; /* CHECK constraints */
357  bool needs_override; /* has GENERATED ALWAYS AS IDENTITY */
358  char *amname; /* relation access method */
359 
360  /*
361  * Stuff computed only for dumpable tables.
362  */
363  int numIndexes; /* number of indexes */
364  struct _indxInfo *indexes; /* indexes */
365  struct _tableDataInfo *dataObj; /* TableDataInfo, if dumping its data */
366  int numTriggers; /* number of triggers for table */
367  struct _triggerInfo *triggers; /* array of TriggerInfo structs */
369 
370 typedef struct _tableAttachInfo
371 {
373  TableInfo *parentTbl; /* link to partitioned table */
374  TableInfo *partitionTbl; /* link to partition */
376 
377 typedef struct _attrDefInfo
378 {
379  DumpableObject dobj; /* note: dobj.name is name of table */
380  TableInfo *adtable; /* link to table of attribute */
381  int adnum;
382  char *adef_expr; /* decompiled DEFAULT expression */
383  bool separate; /* true if must dump as separate item */
385 
386 typedef struct _tableDataInfo
387 {
389  TableInfo *tdtable; /* link to table to dump */
390  char *filtercond; /* WHERE condition to limit rows dumped */
392 
393 typedef struct _indxInfo
394 {
396  TableInfo *indextable; /* link to table the index is for */
397  char *indexdef;
398  char *tablespace; /* tablespace in which index is stored */
399  char *indreloptions; /* options specified by WITH (...) */
400  char *indstatcols; /* column numbers with statistics */
401  char *indstatvals; /* statistic values for columns */
402  int indnkeyattrs; /* number of index key attributes */
403  int indnattrs; /* total number of index attributes */
404  Oid *indkeys; /* In spite of the name 'indkeys' this field
405  * contains both key and nonkey attributes */
409  Oid parentidx; /* if a partition, parent index OID */
410  SimplePtrList partattaches; /* if partitioned, partition attach objects */
411 
412  /* if there is an associated constraint object, its dumpId: */
415 
416 typedef struct _indexAttachInfo
417 {
419  IndxInfo *parentIdx; /* link to index on partitioned table */
420  IndxInfo *partitionIdx; /* link to index on partition */
422 
423 typedef struct _statsExtInfo
424 {
426  const char *rolname;
427  int stattarget; /* statistics target */
429 
430 typedef struct _ruleInfo
431 {
433  TableInfo *ruletable; /* link to table the rule is for */
434  char ev_type;
437  bool separate; /* true if must dump as separate item */
438  /* separate is always true for non-ON SELECT rules */
440 
441 typedef struct _triggerInfo
442 {
444  TableInfo *tgtable; /* link to table the trigger is for */
445  char *tgfname;
446  int tgtype;
447  int tgnargs;
448  char *tgargs;
453  char tgenabled;
457  char *tgdef;
459 
460 typedef struct _evttriggerInfo
461 {
463  char *evtname;
464  char *evtevent;
465  const char *evtowner;
466  char *evttags;
467  char *evtfname;
470 
471 /*
472  * struct ConstraintInfo is used for all constraint types. However we
473  * use a different objType for foreign key constraints, to make it easier
474  * to sort them the way we want.
475  *
476  * Note: condeferrable and condeferred are currently only valid for
477  * unique/primary-key constraints. Otherwise that info is in condef.
478  */
479 typedef struct _constraintInfo
480 {
482  TableInfo *contable; /* NULL if domain constraint */
483  TypeInfo *condomain; /* NULL if table constraint */
484  char contype;
485  char *condef; /* definition, if CHECK or FOREIGN KEY */
486  Oid confrelid; /* referenced table, if FOREIGN KEY */
487  DumpId conindex; /* identifies associated index if any */
488  bool condeferrable; /* true if constraint is DEFERRABLE */
489  bool condeferred; /* true if constraint is INITIALLY DEFERRED */
490  bool conislocal; /* true if constraint has local definition */
491  bool separate; /* true if must dump as separate item */
493 
494 typedef struct _procLangInfo
495 {
502  const char *lanowner;
504 
505 typedef struct _castInfo
506 {
514 
515 typedef struct _transformInfo
516 {
523 
524 /* InhInfo isn't a DumpableObject, just temporary state */
525 typedef struct _inhInfo
526 {
527  Oid inhrelid; /* OID of a child table */
528  Oid inhparent; /* OID of its parent */
530 
531 typedef struct _prsInfo
532 {
540 
541 typedef struct _dictInfo
542 {
544  const char *rolname;
548 
549 typedef struct _tmplInfo
550 {
555 
556 typedef struct _cfgInfo
557 {
559  const char *rolname;
562 
563 typedef struct _fdwInfo
564 {
567  const char *rolname;
568  char *fdwhandler;
570  char *fdwoptions;
572 
573 typedef struct _foreignServerInfo
574 {
577  const char *rolname;
579  char *srvtype;
580  char *srvversion;
581  char *srvoptions;
583 
584 typedef struct _defaultACLInfo
585 {
588  const char *defaclrole;
591 
592 typedef struct _loInfo
593 {
596  const char *rolname;
598 
599 /*
600  * The PolicyInfo struct is used to represent policies on a table and
601  * to indicate if a table has RLS enabled (ENABLE ROW SECURITY). If
602  * polname is NULL, then the record indicates ENABLE ROW SECURITY, while if
603  * it's non-NULL then this is a regular policy definition.
604  */
605 typedef struct _policyInfo
606 {
609  char *polname; /* null indicates RLS is enabled on rel */
610  char polcmd;
612  char *polroles;
613  char *polqual;
616 
617 /*
618  * The PublicationInfo struct is used to represent publications.
619  */
620 typedef struct _PublicationInfo
621 {
623  const char *rolname;
625  bool pubinsert;
626  bool pubupdate;
627  bool pubdelete;
631 
632 /*
633  * The PublicationRelInfo struct is used to represent publication table
634  * mapping.
635  */
636 typedef struct _PublicationRelInfo
637 {
641  char *pubrelqual;
642  char *pubrattrs;
644 
645 /*
646  * The PublicationSchemaInfo struct is used to represent publication schema
647  * mapping.
648  */
650 {
655 
656 /*
657  * The SubscriptionInfo struct is used to represent subscription.
658  */
659 typedef struct _SubscriptionInfo
660 {
662  const char *rolname;
663  char *subbinary;
664  char *substream;
669  char *subconninfo;
670  char *subslotname;
673  char *suborigin;
675 
676 /*
677  * common utility functions
678  */
679 
680 extern TableInfo *getSchemaData(Archive *fout, int *numTablesPtr);
681 
682 extern void AssignDumpId(DumpableObject *dobj);
683 extern DumpId createDumpId(void);
684 extern DumpId getMaxDumpId(void);
687 extern void getDumpableObjects(DumpableObject ***objs, int *numObjs);
688 
689 extern void addObjectDependency(DumpableObject *dobj, DumpId refId);
690 extern void removeObjectDependency(DumpableObject *dobj, DumpId refId);
691 
692 extern TableInfo *findTableByOid(Oid oid);
693 extern TypeInfo *findTypeByOid(Oid oid);
694 extern FuncInfo *findFuncByOid(Oid oid);
695 extern OprInfo *findOprByOid(Oid oid);
696 extern CollInfo *findCollationByOid(Oid oid);
700 
701 extern void recordExtensionMembership(CatalogId catId, ExtensionInfo *ext);
702 extern ExtensionInfo *findOwningExtension(CatalogId catalogId);
703 
704 extern void parseOidArray(const char *str, Oid *array, int arraysize);
705 
706 extern void sortDumpableObjects(DumpableObject **objs, int numObjs,
707  DumpId preBoundaryId, DumpId postBoundaryId);
708 extern void sortDumpableObjectsByTypeName(DumpableObject **objs, int numObjs);
709 
710 /*
711  * version specific routines
712  */
713 extern NamespaceInfo *getNamespaces(Archive *fout, int *numNamespaces);
714 extern ExtensionInfo *getExtensions(Archive *fout, int *numExtensions);
715 extern TypeInfo *getTypes(Archive *fout, int *numTypes);
716 extern FuncInfo *getFuncs(Archive *fout, int *numFuncs);
717 extern AggInfo *getAggregates(Archive *fout, int *numAggs);
718 extern OprInfo *getOperators(Archive *fout, int *numOprs);
719 extern AccessMethodInfo *getAccessMethods(Archive *fout, int *numAccessMethods);
720 extern OpclassInfo *getOpclasses(Archive *fout, int *numOpclasses);
721 extern OpfamilyInfo *getOpfamilies(Archive *fout, int *numOpfamilies);
722 extern CollInfo *getCollations(Archive *fout, int *numCollations);
723 extern ConvInfo *getConversions(Archive *fout, int *numConversions);
724 extern TableInfo *getTables(Archive *fout, int *numTables);
725 extern void getOwnedSeqs(Archive *fout, TableInfo tblinfo[], int numTables);
726 extern InhInfo *getInherits(Archive *fout, int *numInherits);
727 extern void getPartitioningInfo(Archive *fout);
728 extern void getIndexes(Archive *fout, TableInfo tblinfo[], int numTables);
729 extern void getExtendedStatistics(Archive *fout);
730 extern void getConstraints(Archive *fout, TableInfo tblinfo[], int numTables);
731 extern RuleInfo *getRules(Archive *fout, int *numRules);
732 extern void getTriggers(Archive *fout, TableInfo tblinfo[], int numTables);
733 extern ProcLangInfo *getProcLangs(Archive *fout, int *numProcLangs);
734 extern CastInfo *getCasts(Archive *fout, int *numCasts);
735 extern TransformInfo *getTransforms(Archive *fout, int *numTransforms);
736 extern void getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables);
737 extern bool shouldPrintColumn(const DumpOptions *dopt, const TableInfo *tbinfo, int colno);
738 extern TSParserInfo *getTSParsers(Archive *fout, int *numTSParsers);
739 extern TSDictInfo *getTSDictionaries(Archive *fout, int *numTSDicts);
740 extern TSTemplateInfo *getTSTemplates(Archive *fout, int *numTSTemplates);
741 extern TSConfigInfo *getTSConfigurations(Archive *fout, int *numTSConfigs);
743  int *numForeignDataWrappers);
745  int *numForeignServers);
746 extern DefaultACLInfo *getDefaultACLs(Archive *fout, int *numDefaultACLs);
747 extern void getExtensionMembership(Archive *fout, ExtensionInfo extinfo[],
748  int numExtensions);
749 extern void processExtensionTables(Archive *fout, ExtensionInfo extinfo[],
750  int numExtensions);
751 extern EventTriggerInfo *getEventTriggers(Archive *fout, int *numEventTriggers);
752 extern void getPolicies(Archive *fout, TableInfo tblinfo[], int numTables);
754  int *numPublications);
755 extern void getPublicationNamespaces(Archive *fout);
756 extern void getPublicationTables(Archive *fout, TableInfo tblinfo[],
757  int numTables);
758 extern void getSubscriptions(Archive *fout);
759 
760 #endif /* PG_DUMP_H */
unsigned int uint32
Definition: c.h:495
int DumpId
Definition: pg_backup.h:268
NamespaceInfo * getNamespaces(Archive *fout, int *numNamespaces)
Definition: pg_dump.c:5197
void getConstraints(Archive *fout, TableInfo tblinfo[], int numTables)
Definition: pg_dump.c:7346
struct _collInfo CollInfo
struct _transformInfo TransformInfo
void recordExtensionMembership(CatalogId catId, ExtensionInfo *ext)
Definition: common.c:988
void getPublicationNamespaces(Archive *fout)
Definition: pg_dump.c:4250
struct _opfamilyInfo OpfamilyInfo
void getPartitioningInfo(Archive *fout)
Definition: pg_dump.c:6904
struct _indxInfo IndxInfo
DefaultACLInfo * getDefaultACLs(Archive *fout, int *numDefaultACLs)
Definition: pg_dump.c:9599
struct _fdwInfo FdwInfo
struct _triggerInfo TriggerInfo
struct _tmplInfo TSTemplateInfo
struct _tableInfo TableInfo
FuncInfo * findFuncByOid(Oid oid)
Definition: common.c:879
struct _aggInfo AggInfo
void getPolicies(Archive *fout, TableInfo tblinfo[], int numTables)
Definition: pg_dump.c:3765
struct _castInfo CastInfo
void getExtensionMembership(Archive *fout, ExtensionInfo extinfo[], int numExtensions)
Definition: pg_dump.c:18006
struct _tableDataInfo TableDataInfo
ForeignServerInfo * getForeignServers(Archive *fout, int *numForeignServers)
Definition: pg_dump.c:9505
NamespaceInfo * findNamespaceByOid(Oid oid)
Definition: common.c:933
struct _cfgInfo TSConfigInfo
AccessMethodInfo * getAccessMethods(Archive *fout, int *numAccessMethods)
Definition: pg_dump.c:5788
FdwInfo * getForeignDataWrappers(Archive *fout, int *numForeignDataWrappers)
Definition: pg_dump.c:9415
FuncInfo * getFuncs(Archive *fout, int *numFuncs)
Definition: pg_dump.c:6140
TSConfigInfo * getTSConfigurations(Archive *fout, int *numTSConfigs)
Definition: pg_dump.c:9350
struct _dumpableObject DumpableObject
struct _accessMethodInfo AccessMethodInfo
struct _attrDefInfo AttrDefInfo
ConvInfo * getConversions(Archive *fout, int *numConversions)
Definition: pg_dump.c:5720
void getOwnedSeqs(Archive *fout, TableInfo tblinfo[], int numTables)
Definition: pg_dump.c:6785
ExtensionInfo * findOwningExtension(CatalogId catalogId)
Definition: common.c:1012
TableInfo * getSchemaData(Archive *fout, int *numTablesPtr)
Definition: common.c:96
struct _ruleInfo RuleInfo
void getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
Definition: pg_dump.c:4337
AggInfo * getAggregates(Archive *fout, int *numAggs)
Definition: pg_dump.c:5993
DumpableObject * findObjectByCatalogId(CatalogId catalogId)
Definition: common.c:739
void getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
Definition: pg_dump.c:6964
void addObjectDependency(DumpableObject *dobj, DumpId refId)
Definition: common.c:779
struct _foreignServerInfo ForeignServerInfo
DumpableObject * findObjectByDumpId(DumpId dumpId)
Definition: common.c:726
void parseOidArray(const char *str, Oid *array, int arraysize)
Definition: common.c:1036
struct _inhInfo InhInfo
struct _indexAttachInfo IndexAttachInfo
struct _procLangInfo ProcLangInfo
TSDictInfo * getTSDictionaries(Archive *fout, int *numTSDicts)
Definition: pg_dump.c:9213
InhInfo * getInherits(Archive *fout, int *numInherits)
Definition: pg_dump.c:6848
OpfamilyInfo * getOpfamilies(Archive *fout, int *numOpfamilies)
Definition: pg_dump.c:5925
void getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
Definition: pg_dump.c:8381
struct _prsInfo TSParserInfo
struct _policyInfo PolicyInfo
TableInfo * findTableByOid(Oid oid)
Definition: common.c:824
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:4050
DumpId createDumpId(void)
Definition: common.c:706
TSTemplateInfo * getTSTemplates(Archive *fout, int *numTSTemplates)
Definition: pg_dump.c:9285
ProcLangInfo * getProcLangs(Archive *fout, int *numProcLangs)
Definition: pg_dump.c:8084
struct _loInfo LoInfo
TypeInfo * getTypes(Archive *fout, int *numTypes)
Definition: pg_dump.c:5408
ExtensionInfo * findExtensionByOid(Oid oid)
Definition: common.c:951
void AssignDumpId(DumpableObject *dobj)
Definition: common.c:642
struct _evttriggerInfo EventTriggerInfo
void getExtendedStatistics(Archive *fout)
Definition: pg_dump.c:7274
struct _dumpableAcl DumpableAcl
void processExtensionTables(Archive *fout, ExtensionInfo extinfo[], int numExtensions)
Definition: pg_dump.c:18099
DumpId getMaxDumpId(void)
Definition: common.c:715
OpclassInfo * getOpclasses(Archive *fout, int *numOpclasses)
Definition: pg_dump.c:5859
uint32 DumpComponents
Definition: pg_dump.h:94
CollInfo * getCollations(Archive *fout, int *numCollations)
Definition: pg_dump.c:5652
struct _typeInfo TypeInfo
void getSubscriptions(Archive *fout)
Definition: pg_dump.c:4591
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
ExtensionInfo * getExtensions(Archive *fout, int *numExtensions)
Definition: pg_dump.c:5333
void getDumpableObjects(DumpableObject ***objs, int *numObjs)
Definition: common.c:758
struct _statsExtInfo StatsExtInfo
CollInfo * findCollationByOid(Oid oid)
Definition: common.c:915
TSParserInfo * getTSParsers(Archive *fout, int *numTSParsers)
Definition: pg_dump.c:9133
TransformInfo * getTransforms(Archive *fout, int *numTransforms)
Definition: pg_dump.c:8290
void getTriggers(Archive *fout, TableInfo tblinfo[], int numTables)
Definition: pg_dump.c:7727
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_LARGE_OBJECT
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_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_LARGE_OBJECT_DATA
Definition: pg_dump.h:76
@ 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:860
OprInfo * getOperators(Archive *fout, int *numOprs)
Definition: pg_dump.c:5578
RuleInfo * getRules(Archive *fout, int *numRules)
Definition: pg_dump.c:7626
OprInfo * findOprByOid(Oid oid)
Definition: common.c:897
struct _PublicationRelInfo PublicationRelInfo
void sortDumpableObjectsByTypeName(DumpableObject **objs, int numObjs)
Definition: pg_dump_sort.c:186
struct _convInfo ConvInfo
EventTriggerInfo * getEventTriggers(Archive *fout, int *numEventTriggers)
Definition: pg_dump.c:7997
struct _constraintInfo ConstraintInfo
TableInfo * getTables(Archive *fout, int *numTables)
Definition: pg_dump.c:6339
bool shouldPrintColumn(const DumpOptions *dopt, const TableInfo *tbinfo, int colno)
Definition: pg_dump.c:9115
struct _tableAttachInfo TableAttachInfo
void removeObjectDependency(DumpableObject *dobj, DumpId refId)
Definition: common.c:804
CastInfo * getCasts(Archive *fout, int *numCasts)
Definition: pg_dump.c:8174
struct _oprInfo OprInfo
PublicationInfo * findPublicationByOid(Oid oid)
Definition: common.c:969
struct _PublicationSchemaInfo PublicationSchemaInfo
unsigned int Oid
Definition: postgres_ext.h:31
const char * rolname
Definition: pg_dump.h:623
bool puballtables
Definition: pg_dump.h:624
bool pubtruncate
Definition: pg_dump.h:628
DumpableObject dobj
Definition: pg_dump.h:622
TableInfo * pubtable
Definition: pg_dump.h:640
PublicationInfo * publication
Definition: pg_dump.h:639
DumpableObject dobj
Definition: pg_dump.h:638
NamespaceInfo * pubschema
Definition: pg_dump.h:653
DumpableObject dobj
Definition: pg_dump.h:651
PublicationInfo * publication
Definition: pg_dump.h:652
char * suborigin
Definition: pg_dump.h:673
char * subbinary
Definition: pg_dump.h:663
const char * rolname
Definition: pg_dump.h:662
char * subrunasowner
Definition: pg_dump.h:668
char * subsynccommit
Definition: pg_dump.h:671
char * subpublications
Definition: pg_dump.h:672
char * subtwophasestate
Definition: pg_dump.h:665
char * substream
Definition: pg_dump.h:664
char * subpasswordrequired
Definition: pg_dump.h:667
char * subslotname
Definition: pg_dump.h:670
char * subdisableonerr
Definition: pg_dump.h:666
char * subconninfo
Definition: pg_dump.h:669
DumpableObject dobj
Definition: pg_dump.h:661
char * amhandler
Definition: pg_dump.h:252
DumpableObject dobj
Definition: pg_dump.h:250
FuncInfo aggfn
Definition: pg_dump.h:236
DumpableObject dobj
Definition: pg_dump.h:379
char * adef_expr
Definition: pg_dump.h:382
TableInfo * adtable
Definition: pg_dump.h:380
bool separate
Definition: pg_dump.h:383
char castmethod
Definition: pg_dump.h:512
Oid casttarget
Definition: pg_dump.h:509
char castcontext
Definition: pg_dump.h:511
DumpableObject dobj
Definition: pg_dump.h:507
Oid castsource
Definition: pg_dump.h:508
Oid castfunc
Definition: pg_dump.h:510
Oid cfgparser
Definition: pg_dump.h:560
DumpableObject dobj
Definition: pg_dump.h:558
const char * rolname
Definition: pg_dump.h:559
const char * rolname
Definition: pg_dump.h:270
DumpableObject dobj
Definition: pg_dump.h:269
TypeInfo * condomain
Definition: pg_dump.h:483
TableInfo * contable
Definition: pg_dump.h:482
bool condeferred
Definition: pg_dump.h:489
bool conislocal
Definition: pg_dump.h:490
DumpableObject dobj
Definition: pg_dump.h:481
DumpId conindex
Definition: pg_dump.h:487
bool condeferrable
Definition: pg_dump.h:488
char * condef
Definition: pg_dump.h:485
DumpableObject dobj
Definition: pg_dump.h:275
const char * rolname
Definition: pg_dump.h:276
DumpableObject dobj
Definition: pg_dump.h:586
DumpableAcl dacl
Definition: pg_dump.h:587
const char * defaclrole
Definition: pg_dump.h:588
char defaclobjtype
Definition: pg_dump.h:589
char * dictinitoption
Definition: pg_dump.h:546
DumpableObject dobj
Definition: pg_dump.h:543
const char * rolname
Definition: pg_dump.h:544
Oid dicttemplate
Definition: pg_dump.h:545
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:464
char * evtfname
Definition: pg_dump.h:467
char evtenabled
Definition: pg_dump.h:468
char * evtname
Definition: pg_dump.h:463
const char * evtowner
Definition: pg_dump.h:465
char * evttags
Definition: pg_dump.h:466
DumpableObject dobj
Definition: pg_dump.h:462
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:568
const char * rolname
Definition: pg_dump.h:567
char * fdwvalidator
Definition: pg_dump.h:569
char * fdwoptions
Definition: pg_dump.h:570
DumpableAcl dacl
Definition: pg_dump.h:566
DumpableObject dobj
Definition: pg_dump.h:565
DumpableAcl dacl
Definition: pg_dump.h:576
char * srvoptions
Definition: pg_dump.h:581
DumpableObject dobj
Definition: pg_dump.h:575
const char * rolname
Definition: pg_dump.h:577
char * srvversion
Definition: pg_dump.h:580
bool postponed_def
Definition: pg_dump.h:230
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:420
DumpableObject dobj
Definition: pg_dump.h:418
IndxInfo * parentIdx
Definition: pg_dump.h:419
bool indisreplident
Definition: pg_dump.h:407
int indnkeyattrs
Definition: pg_dump.h:402
char * indstatvals
Definition: pg_dump.h:401
char * indstatcols
Definition: pg_dump.h:400
int indnattrs
Definition: pg_dump.h:403
TableInfo * indextable
Definition: pg_dump.h:396
Oid parentidx
Definition: pg_dump.h:409
Oid * indkeys
Definition: pg_dump.h:404
char * indreloptions
Definition: pg_dump.h:399
DumpId indexconstraint
Definition: pg_dump.h:413
bool indisclustered
Definition: pg_dump.h:406
SimplePtrList partattaches
Definition: pg_dump.h:410
char * tablespace
Definition: pg_dump.h:398
bool indnullsnotdistinct
Definition: pg_dump.h:408
char * indexdef
Definition: pg_dump.h:397
DumpableObject dobj
Definition: pg_dump.h:395
Oid inhparent
Definition: pg_dump.h:528
Oid inhrelid
Definition: pg_dump.h:527
const char * rolname
Definition: pg_dump.h:596
DumpableObject dobj
Definition: pg_dump.h:594
DumpableAcl dacl
Definition: pg_dump.h:595
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:257
const char * rolname
Definition: pg_dump.h:258
const char * rolname
Definition: pg_dump.h:264
DumpableObject dobj
Definition: pg_dump.h:263
DumpableObject dobj
Definition: pg_dump.h:242
char oprkind
Definition: pg_dump.h:244
Oid oprcode
Definition: pg_dump.h:245
const char * rolname
Definition: pg_dump.h:243
TableInfo * poltable
Definition: pg_dump.h:608
char * polqual
Definition: pg_dump.h:613
char polcmd
Definition: pg_dump.h:610
char * polroles
Definition: pg_dump.h:612
char * polwithcheck
Definition: pg_dump.h:614
DumpableObject dobj
Definition: pg_dump.h:607
bool polpermissive
Definition: pg_dump.h:611
char * polname
Definition: pg_dump.h:609
Oid lanvalidator
Definition: pg_dump.h:501
DumpableAcl dacl
Definition: pg_dump.h:497
DumpableObject dobj
Definition: pg_dump.h:496
Oid laninline
Definition: pg_dump.h:500
const char * lanowner
Definition: pg_dump.h:502
Oid lanplcallfoid
Definition: pg_dump.h:499
bool lanpltrusted
Definition: pg_dump.h:498
DumpableObject dobj
Definition: pg_dump.h:533
Oid prstoken
Definition: pg_dump.h:535
Oid prslextype
Definition: pg_dump.h:538
Oid prsheadline
Definition: pg_dump.h:537
Oid prsstart
Definition: pg_dump.h:534
Oid prsend
Definition: pg_dump.h:536
DumpableObject dobj
Definition: pg_dump.h:432
bool separate
Definition: pg_dump.h:437
char ev_enabled
Definition: pg_dump.h:436
bool is_instead
Definition: pg_dump.h:435
TableInfo * ruletable
Definition: pg_dump.h:433
char ev_type
Definition: pg_dump.h:434
TypeInfo * baseType
Definition: pg_dump.h:218
DumpableObject dobj
Definition: pg_dump.h:216
int stattarget
Definition: pg_dump.h:427
const char * rolname
Definition: pg_dump.h:426
DumpableObject dobj
Definition: pg_dump.h:425
TableInfo * partitionTbl
Definition: pg_dump.h:374
DumpableObject dobj
Definition: pg_dump.h:372
TableInfo * parentTbl
Definition: pg_dump.h:373
TableInfo * tdtable
Definition: pg_dump.h:389
DumpableObject dobj
Definition: pg_dump.h:388
char * filtercond
Definition: pg_dump.h:390
char * attidentity
Definition: pg_dump.h:338
char * reltablespace
Definition: pg_dump.h:291
char ** notnull_constrs
Definition: pg_dump.h:348
int ncheck
Definition: pg_dump.h:307
bool ispartition
Definition: pg_dump.h:321
struct _indxInfo * indexes
Definition: pg_dump.h:364
bool * attislocal
Definition: pg_dump.h:342
DumpableObject dobj
Definition: pg_dump.h:284
bool is_identity_sequence
Definition: pg_dump.h:314
Oid reloftype
Definition: pg_dump.h:309
int numParents
Definition: pg_dump.h:324
bool interesting
Definition: pg_dump.h:318
char * toast_reloptions
Definition: pg_dump.h:294
struct _tableInfo ** parents
Definition: pg_dump.h:325
DumpableAcl dacl
Definition: pg_dump.h:285
bool relispopulated
Definition: pg_dump.h:289
char * attgenerated
Definition: pg_dump.h:339
int * attlen
Definition: pg_dump.h:340
Oid reltype
Definition: pg_dump.h:308
char ** attfdwoptions
Definition: pg_dump.h:346
bool hasoids
Definition: pg_dump.h:301
Oid toast_oid
Definition: pg_dump.h:304
Oid foreign_server
Definition: pg_dump.h:310
bool hasrules
Definition: pg_dump.h:296
struct _triggerInfo * triggers
Definition: pg_dump.h:367
bool * attisdropped
Definition: pg_dump.h:337
bool needs_override
Definition: pg_dump.h:357
struct _constraintInfo * checkexprs
Definition: pg_dump.h:356
int * attstattarget
Definition: pg_dump.h:334
uint32 frozenxid
Definition: pg_dump.h:302
char * typstorage
Definition: pg_dump.h:336
int owning_col
Definition: pg_dump.h:313
char * checkoption
Definition: pg_dump.h:293
int numatts
Definition: pg_dump.h:331
bool hastriggers
Definition: pg_dump.h:297
const char * rolname
Definition: pg_dump.h:286
struct _attrDefInfo ** attrdefs
Definition: pg_dump.h:355
char ** attoptions
Definition: pg_dump.h:343
bool * notnull_throwaway
Definition: pg_dump.h:353
char relreplident
Definition: pg_dump.h:290
int numTriggers
Definition: pg_dump.h:366
uint32 minmxid
Definition: pg_dump.h:303
Oid * attcollation
Definition: pg_dump.h:344
bool * notnull_noinh
Definition: pg_dump.h:352
char * attstorage
Definition: pg_dump.h:335
int toastpages
Definition: pg_dump.h:316
Oid owning_tab
Definition: pg_dump.h:312
struct _tableDataInfo * dataObj
Definition: pg_dump.h:365
char * amname
Definition: pg_dump.h:358
bool dummy_view
Definition: pg_dump.h:319
bool forcerowsec
Definition: pg_dump.h:300
bool hascolumnACLs
Definition: pg_dump.h:298
char ** atttypnames
Definition: pg_dump.h:333
char ** attmissingval
Definition: pg_dump.h:347
char relpersistence
Definition: pg_dump.h:288
char ** attnames
Definition: pg_dump.h:332
char relkind
Definition: pg_dump.h:287
bool hasindex
Definition: pg_dump.h:295
bool unsafe_partitions
Definition: pg_dump.h:322
char * reloptions
Definition: pg_dump.h:292
int numIndexes
Definition: pg_dump.h:363
int relpages
Definition: pg_dump.h:315
uint32 toast_frozenxid
Definition: pg_dump.h:305
uint32 toast_minmxid
Definition: pg_dump.h:306
char * attalign
Definition: pg_dump.h:341
char * attcompression
Definition: pg_dump.h:345
bool postponed_def
Definition: pg_dump.h:320
bool * notnull_inh
Definition: pg_dump.h:354
bool rowsec
Definition: pg_dump.h:299
Oid tmpllexize
Definition: pg_dump.h:553
Oid tmplinit
Definition: pg_dump.h:552
DumpableObject dobj
Definition: pg_dump.h:551
DumpableObject dobj
Definition: pg_dump.h:517
Oid trffromsql
Definition: pg_dump.h:520
int tgtype
Definition: pg_dump.h:446
TableInfo * tgtable
Definition: pg_dump.h:444
bool tgdeferrable
Definition: pg_dump.h:455
DumpableObject dobj
Definition: pg_dump.h:443
char * tgconstrname
Definition: pg_dump.h:450
int tgnargs
Definition: pg_dump.h:447
char tgenabled
Definition: pg_dump.h:453
Oid tgconstrrelid
Definition: pg_dump.h:451
char * tgdef
Definition: pg_dump.h:457
char * tgfname
Definition: pg_dump.h:445
bool tgispartition
Definition: pg_dump.h:454
char * tgargs
Definition: pg_dump.h:448
bool tgisconstraint
Definition: pg_dump.h:449
bool tginitdeferred
Definition: pg_dump.h:456
char * tgconstrrelname
Definition: pg_dump.h:452
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