1 /*-------------------------------------------------------------------------
2  *
3  * pg_dump.h
4  *	  Common header file for the pg_dump utility
5  *
6  * Portions Copyright (c) 1996-2020, 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! */
40 	DO_NAMESPACE,
41 	DO_EXTENSION,
42 	DO_TYPE,
43 	DO_SHELL_TYPE,
44 	DO_FUNC,
45 	DO_AGG,
46 	DO_OPERATOR,
47 	DO_ACCESS_METHOD,
48 	DO_OPCLASS,
49 	DO_OPFAMILY,
50 	DO_COLLATION,
51 	DO_CONVERSION,
52 	DO_TABLE,
53 	DO_ATTRDEF,
54 	DO_INDEX,
55 	DO_INDEX_ATTACH,
56 	DO_STATSEXT,
57 	DO_RULE,
58 	DO_TRIGGER,
59 	DO_CONSTRAINT,
60 	DO_FK_CONSTRAINT,			/* see note for ConstraintInfo */
61 	DO_PROCLANG,
62 	DO_CAST,
63 	DO_TABLE_DATA,
64 	DO_SEQUENCE_SET,
65 	DO_DUMMY_TYPE,
66 	DO_TSPARSER,
67 	DO_TSDICT,
68 	DO_TSTEMPLATE,
69 	DO_TSCONFIG,
70 	DO_FDW,
71 	DO_FOREIGN_SERVER,
72 	DO_DEFAULT_ACL,
73 	DO_TRANSFORM,
74 	DO_BLOB,
75 	DO_BLOB_DATA,
76 	DO_PRE_DATA_BOUNDARY,
77 	DO_POST_DATA_BOUNDARY,
78 	DO_EVENT_TRIGGER,
79 	DO_REFRESH_MATVIEW,
80 	DO_POLICY,
81 	DO_PUBLICATION,
82 	DO_PUBLICATION_REL,
83 	DO_SUBSCRIPTION
84 } DumpableObjectType;
85 
86 /* component types of an object which can be selected for dumping */
87 typedef uint32 DumpComponents;	/* a bitmask of dump object components */
88 #define DUMP_COMPONENT_NONE			(0)
89 #define DUMP_COMPONENT_DEFINITION	(1 << 0)
90 #define DUMP_COMPONENT_DATA			(1 << 1)
91 #define DUMP_COMPONENT_COMMENT		(1 << 2)
92 #define DUMP_COMPONENT_SECLABEL		(1 << 3)
93 #define DUMP_COMPONENT_ACL			(1 << 4)
94 #define DUMP_COMPONENT_POLICY		(1 << 5)
95 #define DUMP_COMPONENT_USERMAP		(1 << 6)
96 #define DUMP_COMPONENT_ALL			(0xFFFF)
97 
98 /*
99  * component types which require us to obtain a lock on the table
100  *
101  * Note that some components only require looking at the information
102  * in the pg_catalog tables and, for those components, we do not need
103  * to lock the table.  Be careful here though- some components use
104  * server-side functions which pull the latest information from
105  * SysCache and in those cases we *do* need to lock the table.
106  *
107  * We do not need locks for the COMMENT and SECLABEL components as
108  * those simply query their associated tables without using any
109  * server-side functions.  We do not need locks for the ACL component
110  * as we pull that information from pg_class without using any
111  * server-side functions that use SysCache.  The USERMAP component
112  * is only relevant for FOREIGN SERVERs and not tables, so no sense
113  * locking a table for that either (that can happen if we are going
114  * to dump "ALL" components for a table).
115  *
116  * We DO need locks for DEFINITION, due to various server-side
117  * functions that are used and POLICY due to pg_get_expr().  We set
118  * this up to grab the lock except in the cases we know to be safe.
119  */
120 #define DUMP_COMPONENTS_REQUIRING_LOCK (\
121 		DUMP_COMPONENT_DEFINITION |\
122 		DUMP_COMPONENT_DATA |\
123 		DUMP_COMPONENT_POLICY)
124 
125 typedef struct _dumpableObject
126 {
127 	DumpableObjectType objType;
128 	CatalogId	catId;			/* zero if not a cataloged object */
129 	DumpId		dumpId;			/* assigned by AssignDumpId() */
130 	char	   *name;			/* object name (should never be NULL) */
131 	struct _namespaceInfo *namespace;	/* containing namespace, or NULL */
132 	DumpComponents dump;		/* bitmask of components to dump */
133 	DumpComponents dump_contains;	/* as above, but for contained objects */
134 	bool		ext_member;		/* true if object is member of extension */
135 	bool		depends_on_ext; /* true if object depends on an extension */
136 	DumpId	   *dependencies;	/* dumpIds of objects this one depends on */
137 	int			nDeps;			/* number of valid dependencies */
138 	int			allocDeps;		/* allocated size of dependencies[] */
139 } DumpableObject;
140 
141 typedef struct _namespaceInfo
142 {
143 	DumpableObject dobj;
144 	char	   *rolname;		/* name of owner, or empty string */
145 	char	   *nspacl;
146 	char	   *rnspacl;
147 	char	   *initnspacl;
148 	char	   *initrnspacl;
149 } NamespaceInfo;
150 
151 typedef struct _extensionInfo
152 {
153 	DumpableObject dobj;
154 	char	   *namespace;		/* schema containing extension's objects */
155 	bool		relocatable;
156 	char	   *extversion;
157 	char	   *extconfig;		/* info about configuration tables */
158 	char	   *extcondition;
159 } ExtensionInfo;
160 
161 typedef struct _typeInfo
162 {
163 	DumpableObject dobj;
164 
165 	/*
166 	 * Note: dobj.name is the raw pg_type.typname entry.  ftypname is the
167 	 * result of format_type(), which will be quoted if needed, and might be
168 	 * schema-qualified too.
169 	 */
170 	char	   *ftypname;
171 	char	   *rolname;		/* name of owner, or empty string */
172 	char	   *typacl;
173 	char	   *rtypacl;
174 	char	   *inittypacl;
175 	char	   *initrtypacl;
176 	Oid			typelem;
177 	Oid			typrelid;
178 	char		typrelkind;		/* 'r', 'v', 'c', etc */
179 	char		typtype;		/* 'b', 'c', etc */
180 	bool		isArray;		/* true if auto-generated array type */
181 	bool		isDefined;		/* true if typisdefined */
182 	/* If needed, we'll create a "shell type" entry for it; link that here: */
183 	struct _shellTypeInfo *shellType;	/* shell-type entry, or NULL */
184 	/* If it's a domain, we store links to its constraints here: */
185 	int			nDomChecks;
186 	struct _constraintInfo *domChecks;
187 } TypeInfo;
188 
189 typedef struct _shellTypeInfo
190 {
191 	DumpableObject dobj;
192 
193 	TypeInfo   *baseType;		/* back link to associated base type */
194 } ShellTypeInfo;
195 
196 typedef struct _funcInfo
197 {
198 	DumpableObject dobj;
199 	char	   *rolname;		/* name of owner, or empty string */
200 	Oid			lang;
201 	int			nargs;
202 	Oid		   *argtypes;
203 	Oid			prorettype;
204 	char	   *proacl;
205 	char	   *rproacl;
206 	char	   *initproacl;
207 	char	   *initrproacl;
208 } FuncInfo;
209 
210 /* AggInfo is a superset of FuncInfo */
211 typedef struct _aggInfo
212 {
213 	FuncInfo	aggfn;
214 	/* we don't require any other fields at the moment */
215 } AggInfo;
216 
217 typedef struct _oprInfo
218 {
219 	DumpableObject dobj;
220 	char	   *rolname;
221 	char		oprkind;
222 	Oid			oprcode;
223 } OprInfo;
224 
225 typedef struct _accessMethodInfo
226 {
227 	DumpableObject dobj;
228 	char		amtype;
229 	char	   *amhandler;
230 } AccessMethodInfo;
231 
232 typedef struct _opclassInfo
233 {
234 	DumpableObject dobj;
235 	char	   *rolname;
236 } OpclassInfo;
237 
238 typedef struct _opfamilyInfo
239 {
240 	DumpableObject dobj;
241 	char	   *rolname;
242 } OpfamilyInfo;
243 
244 typedef struct _collInfo
245 {
246 	DumpableObject dobj;
247 	char	   *rolname;
248 } CollInfo;
249 
250 typedef struct _convInfo
251 {
252 	DumpableObject dobj;
253 	char	   *rolname;
254 } ConvInfo;
255 
256 typedef struct _tableInfo
257 {
258 	/*
259 	 * These fields are collected for every table in the database.
260 	 */
261 	DumpableObject dobj;
262 	char	   *rolname;		/* name of owner, or empty string */
263 	char	   *relacl;
264 	char	   *rrelacl;
265 	char	   *initrelacl;
266 	char	   *initrrelacl;
267 	char		relkind;
268 	char		relpersistence; /* relation persistence */
269 	bool		relispopulated; /* relation is populated */
270 	char		relreplident;	/* replica identifier */
271 	char	   *reltablespace;	/* relation tablespace */
272 	char	   *reloptions;		/* options specified by WITH (...) */
273 	char	   *checkoption;	/* WITH CHECK OPTION, if any */
274 	char	   *toast_reloptions;	/* WITH options for the TOAST table */
275 	bool		hasindex;		/* does it have any indexes? */
276 	bool		hasrules;		/* does it have any rules? */
277 	bool		hastriggers;	/* does it have any triggers? */
278 	bool		rowsec;			/* is row security enabled? */
279 	bool		forcerowsec;	/* is row security forced? */
280 	bool		hasoids;		/* does it have OIDs? */
281 	uint32		frozenxid;		/* table's relfrozenxid */
282 	uint32		minmxid;		/* table's relminmxid */
283 	Oid			toast_oid;		/* toast table's OID, or 0 if none */
284 	uint32		toast_frozenxid;	/* toast table's relfrozenxid, if any */
285 	uint32		toast_minmxid;	/* toast table's relminmxid */
286 	int			ncheck;			/* # of CHECK expressions */
287 	char	   *reloftype;		/* underlying type for typed table */
288 	Oid			foreign_server; /* foreign server oid, if applicable */
289 	/* these two are set only if table is a sequence owned by a column: */
290 	Oid			owning_tab;		/* OID of table owning sequence */
291 	int			owning_col;		/* attr # of column owning sequence */
292 	bool		is_identity_sequence;
293 	int			relpages;		/* table's size in pages (from pg_class) */
294 
295 	bool		interesting;	/* true if need to collect more data */
296 	bool		dummy_view;		/* view's real definition must be postponed */
297 	bool		postponed_def;	/* matview must be postponed into post-data */
298 	bool		ispartition;	/* is table a partition? */
299 
300 	/*
301 	 * These fields are computed only if we decide the table is interesting
302 	 * (it's either a table to dump, or a direct parent of a dumpable table).
303 	 */
304 	int			numatts;		/* number of attributes */
305 	char	  **attnames;		/* the attribute names */
306 	char	  **atttypnames;	/* attribute type names */
307 	int		   *atttypmod;		/* type-specific type modifiers */
308 	int		   *attstattarget;	/* attribute statistics targets */
309 	char	   *attstorage;		/* attribute storage scheme */
310 	char	   *typstorage;		/* type storage scheme */
311 	bool	   *attisdropped;	/* true if attr is dropped; don't dump it */
312 	char	   *attidentity;
313 	char	   *attgenerated;
314 	int		   *attlen;			/* attribute length, used by binary_upgrade */
315 	char	   *attalign;		/* attribute align, used by binary_upgrade */
316 	bool	   *attislocal;		/* true if attr has local definition */
317 	char	  **attoptions;		/* per-attribute options */
318 	Oid		   *attcollation;	/* per-attribute collation selection */
319 	char	  **attfdwoptions;	/* per-attribute fdw options */
320 	char	  **attmissingval;	/* per attribute missing value */
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 	char	   *amname;			/* relation access method */
329 
330 	/*
331 	 * Stuff computed only for dumpable tables.
332 	 */
333 	int			numParents;		/* number of (immediate) parent tables */
334 	struct _tableInfo **parents;	/* TableInfos of immediate parents */
335 	int			numIndexes;		/* number of indexes */
336 	struct _indxInfo *indexes;	/* indexes */
337 	struct _tableDataInfo *dataObj; /* TableDataInfo, if dumping its data */
338 	int			numTriggers;	/* number of triggers for table */
339 	struct _triggerInfo *triggers;	/* array of TriggerInfo structs */
340 } TableInfo;
341 
342 typedef struct _attrDefInfo
343 {
344 	DumpableObject dobj;		/* note: dobj.name is name of table */
345 	TableInfo  *adtable;		/* link to table of attribute */
346 	int			adnum;
347 	char	   *adef_expr;		/* decompiled DEFAULT expression */
348 	bool		separate;		/* true if must dump as separate item */
349 } AttrDefInfo;
350 
351 typedef struct _tableDataInfo
352 {
353 	DumpableObject dobj;
354 	TableInfo  *tdtable;		/* link to table to dump */
355 	char	   *filtercond;		/* WHERE condition to limit rows dumped */
356 } TableDataInfo;
357 
358 typedef struct _indxInfo
359 {
360 	DumpableObject dobj;
361 	TableInfo  *indextable;		/* link to table the index is for */
362 	char	   *indexdef;
363 	char	   *tablespace;		/* tablespace in which index is stored */
364 	char	   *indreloptions;	/* options specified by WITH (...) */
365 	char	   *indstatcols;	/* column numbers with statistics */
366 	char	   *indstatvals;	/* statistic values for columns */
367 	int			indnkeyattrs;	/* number of index key attributes */
368 	int			indnattrs;		/* total number of index attributes */
369 	Oid		   *indkeys;		/* In spite of the name 'indkeys' this field
370 								 * contains both key and nonkey attributes */
371 	bool		indisclustered;
372 	bool		indisreplident;
373 	Oid			parentidx;		/* if a partition, parent index OID */
374 	SimplePtrList partattaches; /* if partitioned, partition attach objects */
375 
376 	/* if there is an associated constraint object, its dumpId: */
377 	DumpId		indexconstraint;
378 } IndxInfo;
379 
380 typedef struct _indexAttachInfo
381 {
382 	DumpableObject dobj;
383 	IndxInfo   *parentIdx;		/* link to index on partitioned table */
384 	IndxInfo   *partitionIdx;	/* link to index on partition */
385 } IndexAttachInfo;
386 
387 typedef struct _statsExtInfo
388 {
389 	DumpableObject dobj;
390 	char	   *rolname;		/* name of owner, or empty string */
391 	int			stattarget;		/* statistics target */
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 	bool		pubviaroot;
609 } PublicationInfo;
610 
611 /*
612  * The PublicationRelInfo struct is used to represent publication table
613  * mapping.
614  */
615 typedef struct _PublicationRelInfo
616 {
617 	DumpableObject dobj;
618 	PublicationInfo *publication;
619 	TableInfo  *pubtable;
620 } PublicationRelInfo;
621 
622 /*
623  * The SubscriptionInfo struct is used to represent subscription.
624  */
625 typedef struct _SubscriptionInfo
626 {
627 	DumpableObject dobj;
628 	char	   *rolname;
629 	char	   *subconninfo;
630 	char	   *subslotname;
631 	char	   *subsynccommit;
632 	char	   *subpublications;
633 } SubscriptionInfo;
634 
635 /*
636  * We build an array of these with an entry for each object that is an
637  * extension member according to pg_depend.
638  */
639 typedef struct _extensionMemberId
640 {
641 	CatalogId	catId;			/* tableoid+oid of some member object */
642 	ExtensionInfo *ext;			/* owning extension */
643 } ExtensionMemberId;
644 
645 /*
646  *	common utility functions
647  */
648 
649 extern TableInfo *getSchemaData(Archive *fout, int *numTablesPtr);
650 
651 extern void AssignDumpId(DumpableObject *dobj);
652 extern DumpId createDumpId(void);
653 extern DumpId getMaxDumpId(void);
654 extern DumpableObject *findObjectByDumpId(DumpId dumpId);
655 extern DumpableObject *findObjectByCatalogId(CatalogId catalogId);
656 extern void getDumpableObjects(DumpableObject ***objs, int *numObjs);
657 
658 extern void addObjectDependency(DumpableObject *dobj, DumpId refId);
659 extern void removeObjectDependency(DumpableObject *dobj, DumpId refId);
660 
661 extern TableInfo *findTableByOid(Oid oid);
662 extern TypeInfo *findTypeByOid(Oid oid);
663 extern FuncInfo *findFuncByOid(Oid oid);
664 extern OprInfo *findOprByOid(Oid oid);
665 extern CollInfo *findCollationByOid(Oid oid);
666 extern NamespaceInfo *findNamespaceByOid(Oid oid);
667 extern ExtensionInfo *findExtensionByOid(Oid oid);
668 extern PublicationInfo *findPublicationByOid(Oid oid);
669 
670 extern void setExtensionMembership(ExtensionMemberId *extmems, int nextmems);
671 extern ExtensionInfo *findOwningExtension(CatalogId catalogId);
672 
673 extern void parseOidArray(const char *str, Oid *array, int arraysize);
674 
675 extern void sortDumpableObjects(DumpableObject **objs, int numObjs,
676 								DumpId preBoundaryId, DumpId postBoundaryId);
677 extern void sortDumpableObjectsByTypeName(DumpableObject **objs, int numObjs);
678 
679 /*
680  * version specific routines
681  */
682 extern NamespaceInfo *getNamespaces(Archive *fout, int *numNamespaces);
683 extern ExtensionInfo *getExtensions(Archive *fout, int *numExtensions);
684 extern TypeInfo *getTypes(Archive *fout, int *numTypes);
685 extern FuncInfo *getFuncs(Archive *fout, int *numFuncs);
686 extern AggInfo *getAggregates(Archive *fout, int *numAggregates);
687 extern OprInfo *getOperators(Archive *fout, int *numOperators);
688 extern AccessMethodInfo *getAccessMethods(Archive *fout, int *numAccessMethods);
689 extern OpclassInfo *getOpclasses(Archive *fout, int *numOpclasses);
690 extern OpfamilyInfo *getOpfamilies(Archive *fout, int *numOpfamilies);
691 extern CollInfo *getCollations(Archive *fout, int *numCollations);
692 extern ConvInfo *getConversions(Archive *fout, int *numConversions);
693 extern TableInfo *getTables(Archive *fout, int *numTables);
694 extern void getOwnedSeqs(Archive *fout, TableInfo tblinfo[], int numTables);
695 extern InhInfo *getInherits(Archive *fout, int *numInherits);
696 extern void getIndexes(Archive *fout, TableInfo tblinfo[], int numTables);
697 extern void getExtendedStatistics(Archive *fout);
698 extern void getConstraints(Archive *fout, TableInfo tblinfo[], int numTables);
699 extern RuleInfo *getRules(Archive *fout, int *numRules);
700 extern void getTriggers(Archive *fout, TableInfo tblinfo[], int numTables);
701 extern ProcLangInfo *getProcLangs(Archive *fout, int *numProcLangs);
702 extern CastInfo *getCasts(Archive *fout, int *numCasts);
703 extern TransformInfo *getTransforms(Archive *fout, int *numTransforms);
704 extern void getTableAttrs(Archive *fout, TableInfo *tbinfo, int numTables);
705 extern bool shouldPrintColumn(DumpOptions *dopt, TableInfo *tbinfo, int colno);
706 extern TSParserInfo *getTSParsers(Archive *fout, int *numTSParsers);
707 extern TSDictInfo *getTSDictionaries(Archive *fout, int *numTSDicts);
708 extern TSTemplateInfo *getTSTemplates(Archive *fout, int *numTSTemplates);
709 extern TSConfigInfo *getTSConfigurations(Archive *fout, int *numTSConfigs);
710 extern FdwInfo *getForeignDataWrappers(Archive *fout,
711 									   int *numForeignDataWrappers);
712 extern ForeignServerInfo *getForeignServers(Archive *fout,
713 											int *numForeignServers);
714 extern DefaultACLInfo *getDefaultACLs(Archive *fout, int *numDefaultACLs);
715 extern void getExtensionMembership(Archive *fout, ExtensionInfo extinfo[],
716 								   int numExtensions);
717 extern void processExtensionTables(Archive *fout, ExtensionInfo extinfo[],
718 								   int numExtensions);
719 extern EventTriggerInfo *getEventTriggers(Archive *fout, int *numEventTriggers);
720 extern void getPolicies(Archive *fout, TableInfo tblinfo[], int numTables);
721 extern PublicationInfo *getPublications(Archive *fout,
722 										int *numPublications);
723 extern void getPublicationTables(Archive *fout, TableInfo tblinfo[],
724 								 int numTables);
725 extern void getSubscriptions(Archive *fout);
726 
727 #endif							/* PG_DUMP_H */
728