1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

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.
This commit is contained in:
Peter Eisentraut
2001-08-12 19:02:39 +00:00
parent f419de8a7f
commit a0c449a0f8
6 changed files with 93 additions and 167 deletions

View File

@ -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