From ca1a20eba46a72beb7ce11b6c2a889f36430280a Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Sun, 17 Nov 1996 04:56:16 +0000
Subject: [PATCH] Fix for -da option of pg_dump.

---
 src/bin/pg_dump/pg_dump.c | 18 +++++++++---------
 src/man/pg_dump.1         | 13 +++++--------
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index e8bffdafff9..2ed22392828 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -20,7 +20,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.14 1996/11/10 01:35:39 bryanh Exp $
+ *    $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.15 1996/11/17 04:56:01 momjian Exp $
  *
  * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
  *
@@ -84,18 +84,15 @@ usage(const char* progname)
     fprintf(stderr, "\t -H hostname \t\t server host name\n");
     fprintf(stderr, "\t -p port     \t\t server port number\n");
     fprintf(stderr, "\t -v          \t\t verbose\n");
-    fprintf(stderr, "\t -d[a]       \t\t dump data as proper insert strings\n");
-    fprintf(stderr, "\t             \t\t (if 'a' then attribute names also)\n");
+    fprintf(stderr, "\t -d          \t\t dump data as proper insert strings\n");
+    fprintf(stderr, "\t -D          \t\t dump data as inserts with attribute names\n");
     fprintf(stderr, "\t -S          \t\t dump out only the schema, no data\n");
     fprintf(stderr, "\t -a          \t\t dump out only the data, no schema\n");
     fprintf(stderr, "\t -t table    \t\t dump for this table only\n");
     fprintf(stderr, "\t -o          \t\t dump object id's (oids)\n");
-    fprintf(stderr, "\n if dbname is not supplied, then the DATABASE environment name is used\n");
+    fprintf(stderr, "\nIf dbname is not supplied, then the DATABASE environment name is used.\n");
     fprintf(stderr, "\n");
 
-    fprintf(stderr, "\tpg_dump dumps out postgres databases and produces a script file\n");
-    fprintf(stderr, "\tof SQL commands to regenerate the schema\n");
-    fprintf(stderr, "\tThe SQL output is designed for import into Postgres95\n");
     exit(1);
 }
 
@@ -137,7 +134,7 @@ main(int argc, char** argv)
 
     progname = *argv;
 
-    while ((c = getopt(argc, argv,"f:H:p:t:vSDd:ao")) != EOF) {
+    while ((c = getopt(argc, argv,"f:H:p:t:vSDdDao")) != EOF) {
 	switch(c) {
 	case 'f': /* output file name */
 	    filename = optarg;
@@ -156,7 +153,10 @@ main(int argc, char** argv)
 	    break;
         case 'd': /* dump data as proper insert strings */
             dumpData = 1;
-            attrNames = strstr(optarg,"a") ? 1 : 0;
+            break;
+        case 'D': /* dump data as proper insert strings with attr names */
+            dumpData = 1;
+            attrNames = 1;
             break;
 	case 't': /* Dump data for this table only */
 	    tablename = optarg;
diff --git a/src/man/pg_dump.1 b/src/man/pg_dump.1
index 0bb289fb851..cb90b234237 100644
--- a/src/man/pg_dump.1
+++ b/src/man/pg_dump.1
@@ -1,6 +1,6 @@
 .\" This is -*-nroff-*-
 .\" XXX standard disclaimer belongs here....
-.\" $Header: /cvsroot/pgsql/src/man/Attic/pg_dump.1,v 1.1 1996/11/14 10:17:42 scrappy Exp $
+.\" $Header: /cvsroot/pgsql/src/man/Attic/pg_dump.1,v 1.2 1996/11/17 04:56:16 momjian Exp $
 .TH PG_DUMP UNIX 1/20/96 Postgres95 Postgres95
 .SH NAME
 pg_dump \(em dumps out a Postgres database into a script file
@@ -21,7 +21,10 @@ port]
 .BR "-v"
 ]
 [\c
-.BR "-d[a]"
+.BR "-d"
+]
+[\c
+.BR "-D"
 ]
 [\c
 .BR "-S"
@@ -75,11 +78,5 @@ the same as above.  Partial index predicates are stored as plans)
 .BR "large objects"
 pg_dump does not handle large objects.  Large objects are ignored and
 must be dealt with manually. 
-.TP
-.BR "oid preservation"
-pg_dump does not preserve oid's while dumping.  If you have
-stored oid's explicitly in tables in user-defined attributes,
-and are using them as keys, then the output scripts will not
-regenerate your database correctly. 
 .SH "SEE ALSO"
 copy(l)
-- 
GitLab