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