diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2013-03-26 15:21:57 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2013-03-26 15:32:02 +0200 |
commit | 901b89e37bb8e71224ee76987679010ff3c93c05 (patch) | |
tree | 53e8156f6a64650c34c01f3de722ab540b613c5f /src/bin/pg_dump/pg_backup_db.c | |
parent | ec143f94051779bb5d07419723529b4cc4fcce95 (diff) | |
download | postgresql-901b89e37bb8e71224ee76987679010ff3c93c05.tar.gz postgresql-901b89e37bb8e71224ee76987679010ff3c93c05.zip |
Get rid of obsolete parse_version helper function.
For getting the server's version in numeric form, use PQserverVersion().
It does the exact same parsing as dumputils.c's parse_version(), and has
been around in libpq for a long time. For the client's version, just use
the PG_VERSION_NUM constant.
Diffstat (limited to 'src/bin/pg_dump/pg_backup_db.c')
-rw-r--r-- | src/bin/pg_dump/pg_backup_db.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c index 544d01a4ddc..e16c193e3be 100644 --- a/src/bin/pg_dump/pg_backup_db.c +++ b/src/bin/pg_dump/pg_backup_db.c @@ -29,39 +29,23 @@ static void _check_database_version(ArchiveHandle *AH); static PGconn *_connectDB(ArchiveHandle *AH, const char *newdbname, const char *newUser); static void notice_processor(void *arg, const char *message); -static int -_parse_version(const char *versionString) -{ - int v; - - v = parse_version(versionString); - if (v < 0) - exit_horribly(modulename, "could not parse version string \"%s\"\n", versionString); - - return v; -} - static void _check_database_version(ArchiveHandle *AH) { - int myversion; const char *remoteversion_str; int remoteversion; - myversion = _parse_version(PG_VERSION); - remoteversion_str = PQparameterStatus(AH->connection, "server_version"); - if (!remoteversion_str) + remoteversion = PQserverVersion(AH->connection); + if (remoteversion == 0 || !remoteversion_str) exit_horribly(modulename, "could not get server_version from libpq\n"); - remoteversion = _parse_version(remoteversion_str); - AH->public.remoteVersionStr = pg_strdup(remoteversion_str); AH->public.remoteVersion = remoteversion; if (!AH->archiveRemoteVersion) AH->archiveRemoteVersion = AH->public.remoteVersionStr; - if (myversion != remoteversion + if (remoteversion != PG_VERSION_NUM && (remoteversion < AH->public.minRemoteVersion || remoteversion > AH->public.maxRemoteVersion)) { |