diff -Naur postgresql-7.3.3/doc/src/sgml/backup.sgml postgresql-7.3.3-new/doc/src/sgml/backup.sgml
--- postgresql-7.3.3/doc/src/sgml/backup.sgml 2002-11-06 17:30:39.000000000 -0600
+++ postgresql-7.3.3-new/doc/src/sgml/backup.sgml 2003-07-04 09:58:31.000000000 -0500
@@ -92,6 +92,15 @@
+
+
+ If you are storing your schema dumps in CVS, using the -m -M
+ options will clean up your diffs from version to version by
+ omitting some of the SQL comments produced by Postgres that
+ number your entries.
+
+
+
Restoring the dump
diff -Naur postgresql-7.3.3/src/bin/pg_dump/pg_backup_archiver.c postgresql-7.3.3-new/src/bin/pg_dump/pg_backup_archiver.c
--- postgresql-7.3.3/src/bin/pg_dump/pg_backup_archiver.c 2003-05-03 17:19:18.000000000 -0500
+++ postgresql-7.3.3-new/src/bin/pg_dump/pg_backup_archiver.c 2003-07-04 10:17:10.000000000 -0500
@@ -72,6 +72,9 @@
static int _canRestoreBlobs(ArchiveHandle *AH);
static int _restoringToDB(ArchiveHandle *AH);
+bool should_print_oid_comment = true; /* These two control output to make it more suitable for CVS */
+bool should_print_toc_entry_comment = true;
+
/*
* Wrapper functions.
*
@@ -2216,10 +2219,21 @@
else
pfx = "";
- ahprintf(AH, "--\n-- %sTOC entry %d (OID %s)\n-- Name: %s; Type: %s; Schema: %s; Owner: %s\n",
- pfx, te->id, te->oid, te->tag, te->desc,
- te->namespace ? te->namespace : "-",
- te->owner);
+ ahprintf(AH, "--\n-- ");
+
+ if(should_print_toc_entry_comment)
+ {
+ ahprintf(AH, "%sTOC entry %d ", pfx, te->id);
+ }
+ if(should_print_oid_comment)
+ {
+ ahprintf(AH, "(OID %s)", te->oid);
+ }
+ ahprintf(AH, "\n-- Name %s; Type: %s; Schema: %s; Owner: %s\n",
+ te->tag, te->desc,
+ te->namespace ? te->namespace : "-",
+ te->owner);
+
if (AH->PrintExtraTocPtr !=NULL)
(*AH->PrintExtraTocPtr) (AH, te);
ahprintf(AH, "--\n\n");
diff -Naur postgresql-7.3.3/src/bin/pg_dump/pg_dump.c postgresql-7.3.3-new/src/bin/pg_dump/pg_dump.c
--- postgresql-7.3.3/src/bin/pg_dump/pg_dump.c 2003-05-16 08:57:03.000000000 -0500
+++ postgresql-7.3.3-new/src/bin/pg_dump/pg_dump.c 2003-07-04 10:20:07.000000000 -0500
@@ -201,6 +201,8 @@
{"column-inserts", no_argument, NULL, 'D'},
{"host", required_argument, NULL, 'h'},
{"ignore-version", no_argument, NULL, 'i'},
+ {"no-oid-comment", no_argument, NULL, 'm'},
+ {"no-toc-entry-comment", no_argument, NULL, 'M'},
{"no-reconnect", no_argument, NULL, 'R'},
{"oids", no_argument, NULL, 'o'},
{"no-owner", no_argument, NULL, 'O'},
@@ -270,9 +272,9 @@
}
#ifdef HAVE_GETOPT_LONG
- while ((c = getopt_long(argc, argv, "abcCdDf:F:h:ioOp:RsS:t:uU:vWxX:Z:", long_options, &optindex)) != -1)
+ while ((c = getopt_long(argc, argv, "abcCdDf:F:h:imMoOp:RsS:t:uU:vWxX:Z:", long_options, &optindex)) != -1)
#else
- while ((c = getopt(argc, argv, "abcCdDf:F:h:ioOp:RsS:t:uU:vWxX:Z:-")) != -1)
+ while ((c = getopt(argc, argv, "abcCdDf:F:h:imMoOp:RsS:t:uU:vWxX:Z:-")) != -1)
#endif
{
@@ -321,6 +323,13 @@
ignore_version = true;
break;
+ case 'm':
+ should_print_oid_comment = false;
+ break;
+
+ case 'M':
+ should_print_toc_entry_comment = false;
+ break;
case 'o': /* Dump oids */
oids = true;
break;
@@ -693,6 +704,8 @@
printf(_(" -o, --oids include OIDs in dump\n"));
printf(_(" -O, --no-owner do not output \\connect commands in plain\n"
" text format\n"));
+ printf(_(" -m, --no-oid-comments Don't print the OID comments (makes CVS easier)\n"));
+ printf(_(" -M, --no-toc-entry-comments Don't print the TOC comments (makes CVS easier)\n"));
printf(_(" -R, --no-reconnect disable ALL reconnections to the database in\n"
" plain text format\n"));
printf(_(" -s, --schema-only dump only the schema, no data\n"));
@@ -715,6 +728,8 @@
printf(_(" -o include OIDs in dump\n"));
printf(_(" -O do not output \\connect commands in plain\n"
" text format\n"));
+ printf(_(" -m, Don't print the OID comments (makes CVS easier)\n"));
+ printf(_(" -M, Don't print the TOC comments (makes CVS easier)\n"));
printf(_(" -R disable ALL reconnections to the database in\n"
" plain text format\n"));
printf(_(" -s dump only the schema, no data\n"));
diff -Naur postgresql-7.3.3/src/bin/pg_dump/pg_dump.h postgresql-7.3.3-new/src/bin/pg_dump/pg_dump.h
--- postgresql-7.3.3/src/bin/pg_dump/pg_dump.h 2002-10-09 11:20:25.000000000 -0500
+++ postgresql-7.3.3-new/src/bin/pg_dump/pg_dump.h 2003-07-04 09:46:32.000000000 -0500
@@ -167,6 +167,8 @@
extern bool force_quotes; /* double-quotes for identifiers flag */
extern bool g_verbose; /* verbose flag */
extern Archive *g_fout; /* the script file */
+extern bool should_print_oid_comment; /* these two make the output for palatable for CVS */
+extern bool should_print_toc_entry_comment;
/* placeholders for comment starting and ending delimiters */
extern char g_comment_start[10];
diff -Naur postgresql-7.3.3/src/bin/pg_dump/README postgresql-7.3.3-new/src/bin/pg_dump/README
--- postgresql-7.3.3/src/bin/pg_dump/README 2000-07-21 06:40:08.000000000 -0500
+++ postgresql-7.3.3-new/src/bin/pg_dump/README 2003-07-04 09:50:46.000000000 -0500
@@ -89,6 +89,19 @@
the BLOB files at the end.
+CVS
+===
+
+The pg_dump output is a plain text file. However, all entities in the dump
+are numbered within the contents. This makes using CVS problematic, as the
+numbers for all tables will change with each dump, even if the table itself
+did not change. To get output that is more suitable for CVS usage, add the
+flags -m -M which will disable printing the OID comments and the TOC entry
+comments. This will not affect re-importing the dumps at all, since this
+information was only printed on SQL comments.
+
+
+
Philip Warner, 16-Jul-2000
pjw@rhyme.com.au