Skip to content

Commit a0c449a

Browse files
committed
Make pg_dump handle the new privileges.
Don't hardcode the maximum accepted server version, use PG_VERSION instead. Install a notice processor so notices are handled like error messages. Word smithing.
1 parent f419de8 commit a0c449a

File tree

6 files changed

+93
-167
lines changed

6 files changed

+93
-167
lines changed

doc/src/sgml/ref/pg_dump.sgml

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.33 2001/05/17 21:50:18 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.34 2001/08/12 19:02:39 petere Exp $
33
Postgres documentation
44
-->
55

@@ -121,7 +121,7 @@ Postgres documentation
121121
<term>--data-only</term>
122122
<listitem>
123123
<para>
124-
Dump only the data, not the schema (definitions).
124+
Dump only the data, not the schema (data definitions).
125125
</para>
126126
</listitem>
127127
</varlistentry>
@@ -171,11 +171,15 @@ Postgres documentation
171171

172172
<varlistentry>
173173
<term>-D</term>
174+
<term>--column-inserts</term>
174175
<term>--attribute-inserts</term>
175176
<listitem>
176177
<para>
177178
Dump data as <command>INSERT</command> commands with explicit
178-
column names. This will make restoration very slow.
179+
column names (<literal>INSERT INTO
180+
<replaceable>table</replaceable>
181+
(<replaceable>column</replaceable>, ...) VALUES
182+
...</literal>). This will make restoration very slow.
179183
</para>
180184
</listitem>
181185
</varlistentry>
@@ -320,7 +324,7 @@ Postgres documentation
320324
<term>--schema-only</term>
321325
<listitem>
322326
<para>
323-
Dump only the schema (definitions), no data.
327+
Dump only the schema (data definitions), no data.
324328
</para>
325329
</listitem>
326330
</varlistentry>
@@ -358,10 +362,12 @@ Postgres documentation
358362

359363
<varlistentry>
360364
<term>-x</term>
365+
<term>--no-privileges</term>
361366
<term>--no-acl</term>
362367
<listitem>
363368
<para>
364-
Prevent dumping of ACLs (grant/revoke commands) and table ownership information.
369+
Prevent dumping of access privileges (grant/revoke commands)
370+
and table ownership information.
365371
</para>
366372
</listitem>
367373
</varlistentry>
@@ -467,24 +473,6 @@ connectDBStart() -- connect() failed: No such file or directory
467473
</msgexplan>
468474
</msgentry>
469475

470-
<msgentry>
471-
<msg>
472-
<msgmain>
473-
<msgtext>
474-
<screen><computeroutput>
475-
dumpSequence(<replaceable class="parameter">table</replaceable>): SELECT failed
476-
</computeroutput></screen>
477-
</msgtext>
478-
</msgmain>
479-
</msg>
480-
481-
<msgexplan>
482-
<para>
483-
You do not have permission to read the database.
484-
Contact your <productname>Postgres</productname> site administrator.
485-
</para>
486-
</msgexplan>
487-
</msgentry>
488476
</msgset>
489477

490478
<note>
@@ -503,9 +491,6 @@ dumpSequence(<replaceable class="parameter">table</replaceable>): SELECT failed
503491
<title>Notes</title>
504492
<para>
505493
<command>pg_dump</command> has a few limitations.
506-
The limitations mostly stem from
507-
difficulty in extracting certain meta-information from the system
508-
catalogs.
509494

510495
<itemizedlist>
511496
<listitem>

doc/src/sgml/ref/pg_restore.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.12 2001/05/17 21:50:18 petere Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.13 2001/08/12 19:02:39 petere Exp $ -->
22

33
<refentry id="APP-PGRESTORE">
44
<docinfo>
@@ -405,10 +405,11 @@
405405

406406
<varlistentry>
407407
<term>-x</term>
408+
<term>--no-privileges</term>
408409
<term>--no-acl</term>
409410
<listitem>
410411
<para>
411-
Prevent restoration of ACLs (grant/revoke commands).
412+
Prevent restoration of access privileges (grant/revoke commands).
412413
</para>
413414
</listitem>
414415
</varlistentry>

src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.29 2001/07/03 20:21:48 petere Exp $
18+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.30 2001/08/12 19:02:39 petere Exp $
1919
*
2020
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
2121
*
@@ -777,7 +777,7 @@ StartRestoreBlob(ArchiveHandle *AH, Oid oid)
777777
if (!AH->createdBlobXref)
778778
{
779779
if (!AH->connection)
780-
die_horribly(AH, modulename, "cannot restore BLOBs without a database connection");
780+
die_horribly(AH, modulename, "cannot restore BLOBs without a database connection\n");
781781

782782
CreateBlobXrefTable(AH);
783783
AH->createdBlobXref = 1;

src/bin/pg_dump/pg_backup_db.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Implements the basic DB functions used by the archiver.
66
*
77
* IDENTIFICATION
8-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.22 2001/08/03 19:43:05 tgl Exp $
8+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.23 2001/08/12 19:02:39 petere Exp $
99
*
1010
* NOTES
1111
*
@@ -42,6 +42,7 @@ static const char *modulename = gettext_noop("archiver (db)");
4242
static void _check_database_version(ArchiveHandle *AH, bool ignoreVersion);
4343
static PGconn *_connectDB(ArchiveHandle *AH, const char *newdbname, char *newUser);
4444
static int _executeSqlCommand(ArchiveHandle *AH, PGconn *conn, PQExpBuffer qry, char *desc);
45+
static void notice_processor(void *arg, const char *message);
4546

4647

4748
/*
@@ -164,7 +165,7 @@ _check_database_version(ArchiveHandle *AH, bool ignoreVersion)
164165
if (myversion != remoteversion
165166
&& (remoteversion < AH->public.minRemoteVersion || remoteversion > AH->public.maxRemoteVersion) )
166167
{
167-
write_msg(NULL, "server version: %s, %s version: %s\n",
168+
write_msg(NULL, "server version: %s; %s version: %s\n",
168169
remoteversion_str, progname, PG_VERSION);
169170
if (ignoreVersion)
170171
write_msg(NULL, "proceeding despite version mismatch\n");
@@ -325,6 +326,8 @@ _connectDB(ArchiveHandle *AH, const char *reqdb, char *requser)
325326
if (password)
326327
free(password);
327328

329+
PQsetNoticeProcessor(newConn, notice_processor, NULL);
330+
328331
return newConn;
329332
}
330333

@@ -416,6 +419,8 @@ ConnectDatabase(Archive *AHX,
416419
/* check for version mismatch */
417420
_check_database_version(AH, ignoreVersion);
418421

422+
PQsetNoticeProcessor(AH->connection, notice_processor, NULL);
423+
419424
/*
420425
* AH->currUser = PQuser(AH->connection);
421426
*
@@ -426,6 +431,13 @@ ConnectDatabase(Archive *AHX,
426431
return AH->connection;
427432
}
428433

434+
435+
static void notice_processor(void *arg, const char *message)
436+
{
437+
write_msg(NULL, "%s", message);
438+
}
439+
440+
429441
/* Public interface */
430442
/* Convenience function to send a query. Monitors result to handle COPY statements */
431443
int

0 commit comments

Comments
 (0)