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