1/*-------------------------------------------------------------------------
5 * Public interface to the pg_dump archiver routines.
7 * See the headers to pg_restore for more details.
9 * Copyright (c) 2000, Philip Warner
10 * Rights are granted to use this software in any way so long
11 * as this notice is not removed.
13 * The author is not responsible for loss or damages that may
14 * result from its use.
18 * src/bin/pg_dump/pg_backup.h
20 *-------------------------------------------------------------------------
63/* We need one enum entry per prepared query in pg_dump */
80 #define NUM_PREP_QUERIES (PREPQUERY_GETDOMAINCONSTRAINTS + 1)
82/* Parameters needed by ConnectDatabase; same for dump and restore */
85 /* These fields record the actual command line parameters */
86 char *
dbname;
/* this may be a connstring! */
91 /* If not NULL, this overrides the dbname obtained from command line */
92 /* (but *only* the DB name, not anything else in the connstring) */
98 int createDB;
/* Issue commands to create the database */
99 int noOwner;
/* Don't try to match original object owner */
100 int noTableAm;
/* Don't issue table-AM-related commands */
105 * instead of OWNER TO */
155 int txn_size;
/* restore this many TOCs per txn, if > 0 */
157 bool *
idWanted;
/* array showing which dump IDs to emit */
162 /* flags derived from the user-settable flags */
176 /* various user-settable parameters */
182 /* flags for various command-line long options */
201 /* default, if no "inclusion" switches appear, is to dump everything */
214 /* flags derived from the user-settable flags */
223 * We may want to have some more user-readable data, but in the mean
224 * time this gives us some abstraction and type checking.
242 /* info needed for string escaping */
246 /* other important stuff */
254 /* prepared-query status */
257 /* The rest is private */
262 * pg_dump uses two different mechanisms for identifying database objects:
264 * CatalogId represents an object by the tableoid and oid of its defining
265 * entry in the system catalogs. We need this to interpret pg_depend entries,
268 * DumpId is a simple sequential integer counter assigned as dumpable objects
269 * are identified during a pg_dump run. We use DumpId internally in preference
270 * to CatalogId for two reasons: it's more compact, and we can assign DumpIds
271 * to "objects" that don't have a separate CatalogId. For example, it is
272 * convenient to consider a table, its data, and its ACL as three separate
273 * dumpable "objects" with distinct DumpIds --- this lets us reason about the
274 * order in which to dump these things.
279 /* Note: this struct must not contain any unused bytes */
286 #define InvalidDumpId 0
289 * Function pointer prototypes for assorted callback methods.
294 * Main archiver interface.
303/* Called to write *data* to the archive */
317/* Open an existing archive */
320/* Create a new archive */
327/* The --list option */
336/* Rearrange and filter TOC entries */
339/* Convenience functions used only when writing DATA */
343 #define appendStringLiteralAH(buf,str,AH) \
344 appendStringLiteral(buf, str, (AH)->encoding, (AH)->std_strings)
346#endif /* PG_BACKUP_H */
#define pg_attribute_printf(f, a)
static DataDirSyncMethod sync_method
static AmcheckOptions opts
int EndLO(Archive *AHX, Oid oid)
void ProcessArchiveRestoreOptions(Archive *AHX)
PGconn * GetConnection(Archive *AHX)
RestoreOptions * NewRestoreOptions(void)
void(* SetupWorkerPtrType)(Archive *AH)
int StartLO(Archive *AHX, Oid oid)
enum _archiveFormat ArchiveFormat
Archive * OpenArchive(const char *FileSpec, const ArchiveFormat fmt)
void ConnectDatabaseAhx(Archive *AHX, const ConnParams *cparams, bool isReconnect)
void CloseArchive(Archive *AHX)
struct _connParams ConnParams
Archive * CreateArchive(const char *FileSpec, const ArchiveFormat fmt, const pg_compress_specification compression_spec, bool dosync, ArchiveMode mode, SetupWorkerPtrType setupDumpWorker, DataDirSyncMethod sync_method)
DumpOptions * NewDumpOptions(void)
void SortTocFromFile(Archive *AHX)
@ PREPQUERY_DUMPTABLEATTACH
@ PREPQUERY_DUMPRANGETYPE
@ PREPQUERY_GETATTRIBUTESTATS
@ PREPQUERY_DUMPCOMPOSITETYPE
@ PREPQUERY_GETCOLUMNACLS
@ PREPQUERY_GETDOMAINCONSTRAINTS
int archprintf(Archive *AH, const char *fmt,...) pg_attribute_printf(2
struct _restoreOptions RestoreOptions
void PrintTOCSummary(Archive *AHX)
void SetArchiveOptions(Archive *AH, DumpOptions *dopt, RestoreOptions *ropt)
void DisconnectDatabase(Archive *AHX)
void RestoreArchive(Archive *AHX)
void archputs(const char *s, Archive *AH)
enum _teSection teSection
struct _dumpOptions DumpOptions
enum _archiveMode ArchiveMode
DumpOptions * dumpOptionsFromRestoreOptions(RestoreOptions *ropt)
void InitDumpOptions(DumpOptions *opts)
void WriteData(Archive *AHX, const void *data, size_t dLen)
static PgChecksumMode mode
static void setupDumpWorker(Archive *AH)
int disable_dollar_quoting
int serializable_deferrable
int no_unlogged_table_data
const char * lockWaitTimeout
int load_via_partition_root
SimpleStringList schemaExcludeNames
SimpleStringList functionNames
SimpleStringList tableNames
SimpleStringList indexNames
pg_compress_specification compression_spec
SimpleStringList triggerNames
int disable_dollar_quoting
SimpleStringList schemaNames
const char * lockWaitTimeout
int noDataForFailedTables