diff options
| author | Peter Eisentraut <peter_e@gmx.net> | 2001-08-12 19:02:39 +0000 |
|---|---|---|
| committer | Peter Eisentraut <peter_e@gmx.net> | 2001-08-12 19:02:39 +0000 |
| commit | a0c449a0f8bc29326c7fa9b49c2198a92e35681a (patch) | |
| tree | a4c483fc5dfc9e10d5c2e874c3517c70990e62b7 /src/bin/pg_dump/pg_backup_db.c | |
| parent | f419de8a7f316dee4bc787363586a9ad1864795f (diff) | |
| download | postgresql-a0c449a0f8bc29326c7fa9b49c2198a92e35681a.tar.gz | |
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.
Diffstat (limited to 'src/bin/pg_dump/pg_backup_db.c')
| -rw-r--r-- | src/bin/pg_dump/pg_backup_db.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c index fc5864bc69..f08a0d3085 100644 --- a/src/bin/pg_dump/pg_backup_db.c +++ b/src/bin/pg_dump/pg_backup_db.c @@ -5,7 +5,7 @@ * Implements the basic DB functions used by the archiver. * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.22 2001/08/03 19:43:05 tgl Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.23 2001/08/12 19:02:39 petere Exp $ * * NOTES * @@ -42,6 +42,7 @@ static const char *modulename = gettext_noop("archiver (db)"); static void _check_database_version(ArchiveHandle *AH, bool ignoreVersion); static PGconn *_connectDB(ArchiveHandle *AH, const char *newdbname, char *newUser); static int _executeSqlCommand(ArchiveHandle *AH, PGconn *conn, PQExpBuffer qry, char *desc); +static void notice_processor(void *arg, const char *message); /* @@ -164,7 +165,7 @@ _check_database_version(ArchiveHandle *AH, bool ignoreVersion) if (myversion != remoteversion && (remoteversion < AH->public.minRemoteVersion || remoteversion > AH->public.maxRemoteVersion) ) { - write_msg(NULL, "server version: %s, %s version: %s\n", + write_msg(NULL, "server version: %s; %s version: %s\n", remoteversion_str, progname, PG_VERSION); if (ignoreVersion) write_msg(NULL, "proceeding despite version mismatch\n"); @@ -325,6 +326,8 @@ _connectDB(ArchiveHandle *AH, const char *reqdb, char *requser) if (password) free(password); + PQsetNoticeProcessor(newConn, notice_processor, NULL); + return newConn; } @@ -416,6 +419,8 @@ ConnectDatabase(Archive *AHX, /* check for version mismatch */ _check_database_version(AH, ignoreVersion); + PQsetNoticeProcessor(AH->connection, notice_processor, NULL); + /* * AH->currUser = PQuser(AH->connection); * @@ -426,6 +431,13 @@ ConnectDatabase(Archive *AHX, return AH->connection; } + +static void notice_processor(void *arg, const char *message) +{ + write_msg(NULL, "%s", message); +} + + /* Public interface */ /* Convenience function to send a query. Monitors result to handle COPY statements */ int |
