1 /*-------------------------------------------------------------------------
2  *
3  * pg_dump.h
4  *	  Common header file for the pg_dump utility
5  *
6  * Portions Copyright (c) 1996-2019, 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 	char	   *attgenerated;
317 	int		   *attlen;			/* attribute length, used by binary_upgrade */
318 	char	   *attalign;		/* attribute align, used by binary_upgrade */
319 	bool	   *attislocal;		/* true if attr has local definition */
320 	char	  **attoptions;		/* per-attribute options */
321 	Oid		   *attcollation;	/* per-attribute collation selection */
322 	char	  **attfdwoptions;	/* per-attribute fdw options */
323 	char	  **attmissingval;	/* per attribute missing value */
324 	bool	   *notnull;		/* NOT NULL constraints on attributes */
325 	bool	   *inhNotNull;		/* true if NOT NULL is inherited */
326 	struct _attrDefInfo **attrdefs; /* DEFAULT expressions */
327 	struct _constraintInfo *checkexprs; /* CHECK constraints */
328 	char	   *partkeydef;		/* partition key definition */
329 	char	   *partbound;		/* partition bound definition */
330 	bool		needs_override; /* has GENERATED ALWAYS AS IDENTITY */
331 	char	   *amname;			/* relation access method */
332 
333 	/*
334 	 * Stuff computed only for dumpable tables.
335 	 */
336 	int			numParents;		/* number of (immediate) parent tables */
337 	struct _tableInfo **parents;	/* TableInfos of immediate parents */
338 	int			numIndexes;		/* number of indexes */
339 	struct _indxInfo *indexes;	/* indexes */
340 	struct _tableDataInfo *dataObj; /* TableDataInfo, if dumping its data */
341 	int			numTriggers;	/* number of triggers for table */
342 	struct _triggerInfo *triggers;	/* array of TriggerInfo structs */
343 } TableInfo;
344 
345 typedef struct _attrDefInfo
346 {
347 	DumpableObject dobj;		/* note: dobj.name is name of table */
348 	TableInfo  *adtable;		/* link to table of attribute */
349 	int			adnum;
350 	char	   *adef_expr;		/* decompiled DEFAULT expression */
351 	bool		separate;		/* true if must dump as separate item */
352 } AttrDefInfo;
353 
354 typedef struct _tableDataInfo
355 {
356 	DumpableObject dobj;
357 	TableInfo  *tdtable;		/* link to table to dump */
358 	char	   *filtercond;		/* WHERE condition to limit rows dumped */
359 } TableDataInfo;
360 
361 typedef struct _indxInfo
362 {
363 	DumpableObject dobj;
364 	TableInfo  *indextable;		/* link to table the index is for */
365 	char	   *indexdef;
366 	char	   *tablespace;		/* tablespace in which index is stored */
367 	char	   *indreloptions;	/* options specified by WITH (...) */
368 	char	   *indstatcols;	/* column numbers with statistics */
369 	char	   *indstatvals;	/* statistic values for columns */
370 	int			indnkeyattrs;	/* number of index key attributes */
371 	int			indnattrs;		/* total number of index attributes */
372 	Oid		   *indkeys;		/* In spite of the name 'indkeys' this field
373 								 * contains both key and nonkey attributes */
374 	bool		indisclustered;
375 	bool		indisreplident;
376 	Oid			parentidx;		/* if a partition, parent index OID */
377 	SimplePtrList partattaches;	/* if partitioned, partition attach objects */
378 
379 	/* if there is an associated constraint object, its dumpId: */
380 	DumpId		indexconstraint;
381 } IndxInfo;
382 
383 typedef struct _indexAttachInfo
384 {
385 	DumpableObject dobj;
386 	IndxInfo   *parentIdx;		/* link to index on partitioned table */
387 	IndxInfo   *partitionIdx;	/* link to index on partition */
388 } IndexAttachInfo;
389 
390 typedef struct _statsExtInfo
391 {
392 	DumpableObject dobj;
393 	char	   *rolname;		/* name of owner, or empty string */
394 } StatsExtInfo;
395 
396 typedef struct _ruleInfo
397 {
398 	DumpableObject dobj;
399 	TableInfo  *ruletable;		/* link to table the rule is for */
400 	char		ev_type;
401 	bool		is_instead;
402 	char		ev_enabled;
403 	bool		separate;		/* true if must dump as separate item */
404 	/* separate is always true for non-ON SELECT rules */
405 } RuleInfo;
406 
407 typedef struct _triggerInfo
408 {
409 	DumpableObject dobj;
410 	TableInfo  *tgtable;		/* link to table the trigger is for */
411 	char	   *tgfname;
412 	int			tgtype;
413 	int			tgnargs;
414 	char	   *tgargs;
415 	bool		tgisconstraint;
416 	char	   *tgconstrname;
417 	Oid			tgconstrrelid;
418 	char	   *tgconstrrelname;
419 	char		tgenabled;
420 	bool		tgisinternal;
421 	bool		tgdeferrable;
422 	bool		tginitdeferred;
423 	char	   *tgdef;
424 } TriggerInfo;
425 
426 typedef struct _evttriggerInfo
427 {
428 	DumpableObject dobj;
429 	char	   *evtname;
430 	char	   *evtevent;
431 	char	   *evtowner;
432 	char	   *evttags;
433 	char	   *evtfname;
434 	char		evtenabled;
435 } EventTriggerInfo;
436 
437 /*
438  * struct ConstraintInfo is used for all constraint types.  However we
439  * use a different objType for foreign key constraints, to make it easier
440  * to sort them the way we want.
441  *
442  * Note: condeferrable and condeferred are currently only valid for
443  * unique/primary-key constraints.  Otherwise that info is in condef.
444  */
445 typedef struct _constraintInfo
446 {
447 	DumpableObject dobj;
448 	TableInfo  *contable;		/* NULL if domain constraint */
449 	TypeInfo   *condomain;		/* NULL if table constraint */
450 	char		contype;
451 	char	   *condef;			/* definition, if CHECK or FOREIGN KEY */
452 	Oid			confrelid;		/* referenced table, if FOREIGN KEY */
453 	DumpId		conindex;		/* identifies associated index if any */
454 	bool		condeferrable;	/* true if constraint is DEFERRABLE */
455 	bool		condeferred;	/* true if constraint is INITIALLY DEFERRED */
456 	bool		conislocal;		/* true if constraint has local definition */
457 	bool		separate;		/* true if must dump as separate item */
458 } ConstraintInfo;
459 
460 typedef struct _procLangInfo
461 {
462 	DumpableObject dobj;
463 	bool		lanpltrusted;
464 	Oid			lanplcallfoid;
465 	Oid			laninline;
466 	Oid			lanvalidator;
467 	char	   *lanacl;
468 	char	   *rlanacl;
469 	char	   *initlanacl;
470 	char	   *initrlanacl;
471 	char	   *lanowner;		/* name of owner, or empty string */
472 } ProcLangInfo;
473 
474 typedef struct _castInfo
475 {
476 	DumpableObject dobj;
477 	Oid			castsource;
478 	Oid			casttarget;
479 	Oid			castfunc;
480 	char		castcontext;
481 	char		castmethod;
482 } CastInfo;
483 
484 typedef struct _transformInfo
485 {
486 	DumpableObject dobj;
487 	Oid			trftype;
488 	Oid			trflang;
489 	Oid			trffromsql;
490 	Oid			trftosql;
491 } TransformInfo;
492 
493 /* InhInfo isn't a DumpableObject, just temporary state */
494 typedef struct _inhInfo
495 {
496 	Oid			inhrelid;		/* OID of a child table */
497 	Oid			inhparent;		/* OID of its parent */
498 } InhInfo;
499 
500 typedef struct _prsInfo
501 {
502 	DumpableObject dobj;
503 	Oid			prsstart;
504 	Oid			prstoken;
505 	Oid			prsend;
506 	Oid			prsheadline;
507 	Oid			prslextype;
508 } TSParserInfo;
509 
510 typedef struct _dictInfo
511 {
512 	DumpableObject dobj;
513 	char	   *rolname;
514 	Oid			dicttemplate;
515 	char	   *dictinitoption;
516 } TSDictInfo;
517 
518 typedef struct _tmplInfo
519 {
520 	DumpableObject dobj;
521 	Oid			tmplinit;
522 	Oid			tmpllexize;
523 } TSTemplateInfo;
524 
525 typedef struct _cfgInfo
526 {
527 	DumpableObject dobj;
528 	char	   *rolname;
529 	Oid			cfgparser;
530 } TSConfigInfo;
531 
532 typedef struct _fdwInfo
533 {
534 	DumpableObject dobj;
535 	char	   *rolname;
536 	char	   *fdwhandler;
537 	char	   *fdwvalidator;
538 	char	   *fdwoptions;
539 	char	   *fdwacl;
540 	char	   *rfdwacl;
541 	char	   *initfdwacl;
542 	char	   *initrfdwacl;
543 } FdwInfo;
544 
545 typedef struct _foreignServerInfo
546 {
547 	DumpableObject dobj;
548 	char	   *rolname;
549 	Oid			srvfdw;
550 	char	   *srvtype;
551 	char	   *srvversion;
552 	char	   *srvacl;
553 	char	   *rsrvacl;
554 	char	   *initsrvacl;
555 	char	   *initrsrvacl;
556 	char	   *srvoptions;
557 } ForeignServerInfo;
558 
559 typedef struct _defaultACLInfo
560 {
561 	DumpableObject dobj;
562 	char	   *defaclrole;
563 	char		defaclobjtype;
564 	char	   *defaclacl;
565 	char	   *rdefaclacl;
566 	char	   *initdefaclacl;
567 	char	   *initrdefaclacl;
568 } DefaultACLInfo;
569 
570 typedef struct _blobInfo
571 {
572 	DumpableObject dobj;
573 	char	   *rolname;
574 	char	   *blobacl;
575 	char	   *rblobacl;
576 	char	   *initblobacl;
577 	char	   *initrblobacl;
578 } BlobInfo;
579 
580 /*
581  * The PolicyInfo struct is used to represent policies on a table and
582  * to indicate if a table has RLS enabled (ENABLE ROW SECURITY).  If
583  * polname is NULL, then the record indicates ENABLE ROW SECURITY, while if
584  * it's non-NULL then this is a regular policy definition.
585  */
586 typedef struct _policyInfo
587 {
588 	DumpableObject dobj;
589 	TableInfo  *poltable;
590 	char	   *polname;		/* null indicates RLS is enabled on rel */
591 	char		polcmd;
592 	bool		polpermissive;
593 	char	   *polroles;
594 	char	   *polqual;
595 	char	   *polwithcheck;
596 } PolicyInfo;
597 
598 /*
599  * The PublicationInfo struct is used to represent publications.
600  */
601 typedef struct _PublicationInfo
602 {
603 	DumpableObject dobj;
604 	char	   *rolname;
605 	bool		puballtables;
606 	bool		pubinsert;
607 	bool		pubupdate;
608 	bool		pubdelete;
609 	bool		pubtruncate;
610 } PublicationInfo;
611 
612 /*
613  * The PublicationRelInfo struct is used to represent publication table
614  * mapping.
615  */
616 typedef struct _PublicationRelInfo
617 {
618 	DumpableObject dobj;
619 	PublicationInfo *publication;
620 	TableInfo  *pubtable;
621 } PublicationRelInfo;
622 
623 /*
624  * The SubscriptionInfo struct is used to represent subscription.
625  */
626 typedef struct _SubscriptionInfo
627 {
628 	DumpableObject dobj;
629 	char	   *rolname;
630 	char	   *subconninfo;
631 	char	   *subslotname;
632 	char	   *subsynccommit;
633 	char	   *subpublications;
634 } SubscriptionInfo;
635 
636 /*
637  * We build an array of these with an entry for each object that is an
638  * extension member according to pg_depend.
639  */
640 typedef struct _extensionMemberId
641 {
642 	CatalogId	catId;			/* tableoid+oid of some member object */
643 	ExtensionInfo *ext;			/* owning extension */
644 } ExtensionMemberId;
645 
646 /* global decls */
647 extern bool force_quotes;		/* double-quotes for identifiers flag */
648 
649 /* placeholders for comment starting and ending delimiters */
650 extern char g_comment_start[10];
651 extern char g_comment_end[10];
652 
653 extern char g_opaque_type[10];	/* name for the opaque type */
654 
655 /*
656  *	common utility functions
657  */
658 
659 extern TableInfo *getSchemaData(Archive *fout, int *numTablesPtr);
660 
661 extern void AssignDumpId(DumpableObject *dobj);
662 extern DumpId createDumpId(void);
663 extern DumpId getMaxDumpId(void);
664 extern DumpableObject *findObjectByDumpId(DumpId dumpId);
665 extern DumpableObject *findObjectByCatalogId(CatalogId catalogId);
666 extern void getDumpableObjects(DumpableObject ***objs, int *numObjs);
667 
668 extern void addObjectDependency(DumpableObject *dobj, DumpId refId);
669 extern void removeObjectDependency(DumpableObject *dobj, DumpId refId);
670 
671 extern TableInfo *findTableByOid(Oid oid);
672 extern TypeInfo *findTypeByOid(Oid oid);
673 extern FuncInfo *findFuncByOid(Oid oid);
674 extern OprInfo *findOprByOid(Oid oid);
675 extern CollInfo *findCollationByOid(Oid oid);
676 extern NamespaceInfo *findNamespaceByOid(Oid oid);
677 extern ExtensionInfo *findExtensionByOid(Oid oid);
678 extern PublicationInfo *findPublicationByOid(Oid oid);
679 
680 extern void setExtensionMembership(ExtensionMemberId *extmems, int nextmems);
681 extern ExtensionInfo *findOwningExtension(CatalogId catalogId);
682 
683 extern void parseOidArray(const char *str, Oid *array, int arraysize);
684 
685 extern void sortDumpableObjects(DumpableObject **objs, int numObjs,
686 								DumpId preBoundaryId, DumpId postBoundaryId);
687 extern void sortDumpableObjectsByTypeName(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