]> granicus.if.org Git - postgresql/blobdiff - src/bin/pg_dump/pg_backup.h
Use a macro variable PG_PRINTF_ATTRIBUTE for the style used for checking printf type...
[postgresql] / src / bin / pg_dump / pg_backup.h
index 9f0f7ca3ca1ef7df8ac3bc77335135513e1a5b7c..b37cc19c4e47e204e6776a05dfc456c429acdc95 100644 (file)
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *             $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup.h,v 1.39 2006/05/28 21:13:54 tgl Exp $
+ *             src/bin/pg_dump/pg_backup.h
  *
  *-------------------------------------------------------------------------
  */
@@ -28,7 +28,6 @@
 #include "pg_dump.h"
 
 #include "libpq-fe.h"
-#include "pqexpbuffer.h"
 
 
 #define atooid(x)  ((Oid) strtoul((x), NULL, 10))
 #define oidge(x,y) ( (x) >= (y) )
 #define oidzero(x) ( (x) == 0 )
 
+enum trivalue
+{
+       TRI_DEFAULT,
+       TRI_NO,
+       TRI_YES
+};
+
 typedef enum _archiveFormat
 {
        archUnknown = 0,
        archCustom = 1,
        archFiles = 2,
        archTar = 3,
-       archNull = 4
+       archNull = 4,
+       archDirectory = 5
 } ArchiveFormat;
 
+typedef enum _archiveMode
+{
+       archModeAppend,
+       archModeWrite,
+       archModeRead
+} ArchiveMode;
+
+typedef enum _teSection
+{
+       SECTION_NONE = 1,                       /* COMMENTs, ACLs, etc; can be anywhere */
+       SECTION_PRE_DATA,                       /* stuff to be processed before data */
+       SECTION_DATA,                           /* TABLE DATA, BLOBS, BLOB COMMENTS */
+       SECTION_POST_DATA                       /* stuff to be processed after data */
+} teSection;
+
 /*
  *     We may want to have some more user-readable data, but in the mean
  *     time this gives us some abstraction and type checking.
@@ -75,13 +97,16 @@ typedef int (*DataDumperPtr) (Archive *AH, void *userArg);
 
 typedef struct _restoreOptions
 {
-       int                     create;                 /* Issue commands to create the database */
+       int                     createDB;               /* Issue commands to create the database */
        int                     noOwner;                /* Don't try to match original object owner */
+       int                     noTablespace;   /* Don't issue tablespace-related commands */
        int                     disable_triggers;               /* disable triggers during data-only
                                                                                 * restore */
        int                     use_setsessauth;/* Use SET SESSION AUTHORIZATION commands
                                                                 * instead of OWNER TO */
+       int                     skip_seclabel;  /* Skip security label entries */
        char       *superuser;          /* Username to use as superuser */
+       char       *use_role;           /* Issue SET ROLE to this */
        int                     dataOnly;
        int                     dropSchema;
        char       *filename;
@@ -109,18 +134,16 @@ typedef struct _restoreOptions
        char       *pgport;
        char       *pghost;
        char       *username;
-       int                     ignoreVersion;
-       int                     requirePassword;
+       int                     noDataForFailedTables;
+       enum trivalue promptPassword;
        int                     exit_on_error;
-
-       bool       *idWanted;
-       bool            limitToList;
        int                     compression;
-
        int                     suppressDumpWarnings;   /* Suppress output of WARNING entries
                                                                                 * to stderr */
-    bool        single_txn;
+       bool            single_txn;
+       int                     number_of_jobs;
 
+       bool       *idWanted;           /* array showing which dump IDs to emit */
 } RestoreOptions;
 
 /*
@@ -129,7 +152,7 @@ typedef struct _restoreOptions
 
 extern void
 exit_horribly(Archive *AH, const char *modulename, const char *fmt,...)
-__attribute__((format(printf, 3, 4)));
+__attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4)));
 
 
 /* Lets the archive know we have a DB connection to shutdown if it dies */
@@ -139,9 +162,7 @@ PGconn *ConnectDatabase(Archive *AH,
                                const char *pghost,
                                const char *pgport,
                                const char *username,
-                               const int reqPwd,
-                               const int ignoreVersion);
-
+                               enum trivalue prompt_password);
 
 /* Called to add a TOC entry */
 extern void ArchiveEntry(Archive *AHX,
@@ -149,7 +170,8 @@ extern void ArchiveEntry(Archive *AHX,
                         const char *tag,
                         const char *namespace, const char *tablespace,
                         const char *owner, bool withOids,
-                        const char *desc, const char *defn,
+                        const char *desc, teSection section,
+                        const char *defn,
                         const char *dropStmt, const char *copyStmt,
                         const DumpId *deps, int nDeps,
                         DataDumperPtr dumpFn, void *dumpArg);
@@ -169,22 +191,23 @@ extern Archive *OpenArchive(const char *FileSpec, const ArchiveFormat fmt);
 
 /* Create a new archive */
 extern Archive *CreateArchive(const char *FileSpec, const ArchiveFormat fmt,
-                         const int compression);
+                         const int compression, ArchiveMode mode);
 
 /* The --list option */
 extern void PrintTOCSummary(Archive *AH, RestoreOptions *ropt);
 
 extern RestoreOptions *NewRestoreOptions(void);
 
-/* Rearrange TOC entries */
-extern void SortTocFromFile(Archive *AH, RestoreOptions *ropt);
+/* Rearrange and filter TOC entries */
+extern void SortTocFromFile(Archive *AHX, RestoreOptions *ropt);
+extern void InitDummyWantedList(Archive *AHX, RestoreOptions *ropt);
 
 /* Convenience functions used only when writing DATA */
 extern int     archputs(const char *s, Archive *AH);
 extern int
 archprintf(Archive *AH, const char *fmt,...)
 /* This extension allows gcc to check the format string */
-__attribute__((format(printf, 2, 3)));
+__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
 
 #define appendStringLiteralAH(buf,str,AH) \
        appendStringLiteral(buf, str, (AH)->encoding, (AH)->std_strings)