diff options
author | Robert Haas <rhaas@postgresql.org> | 2013-01-25 08:42:15 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2013-01-25 08:42:15 -0500 |
commit | 881104a698b8c5bd686542337218fab9df2a4015 (patch) | |
tree | 4a40634d9ad66aa27532d6e994345739bfb01842 | |
parent | 1cc43979cf44db0b3da77e34493689fe13484fa0 (diff) | |
download | postgresql-881104a698b8c5bd686542337218fab9df2a4015.tar.gz |
Eliminate use of ExecuteSqlQueryForSingleRow, which is not in 9.1.
Hopefully, this will unbreak the buildfarm.
Andres Freund
-rw-r--r-- | src/bin/pg_dump/pg_dump.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index bef2b430fe..964823f5e6 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -656,9 +656,25 @@ main(int argc, char **argv) * When running against 9.0 or later, check if we are in recovery mode, * which means we are on a hot standby. */ - if (fout->remoteVersion >= 90000) + if (g_fout->remoteVersion >= 90000) { - PGresult *res = ExecuteSqlQueryForSingleRow(fout, "SELECT pg_catalog.pg_is_in_recovery()"); + PGresult *res; + const char *query = "SELECT pg_catalog.pg_is_in_recovery()"; + int ntups; + + res = PQexec(g_conn, query); + check_sql_result(res, g_conn, query, PGRES_TUPLES_OK); + ntups = PQntuples(res); + + if (ntups != 1) + { + write_msg(NULL, ngettext("query returned %d row instead of one: %s\n", + "query returned %d rows instead of one: %s\n", + ntups), + ntups, query); + exit_nicely(); + } + if (strcmp(PQgetvalue(res, 0, 0), "t") == 0) { /* |