Skip to content

Commit 881104a

Browse files
committed
Eliminate use of ExecuteSqlQueryForSingleRow, which is not in 9.1.
Hopefully, this will unbreak the buildfarm. Andres Freund
1 parent 1cc4397 commit 881104a

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,9 +656,25 @@ main(int argc, char **argv)
656656
* When running against 9.0 or later, check if we are in recovery mode,
657657
* which means we are on a hot standby.
658658
*/
659-
if (fout->remoteVersion >= 90000)
659+
if (g_fout->remoteVersion >= 90000)
660660
{
661-
PGresult *res = ExecuteSqlQueryForSingleRow(fout, "SELECT pg_catalog.pg_is_in_recovery()");
661+
PGresult *res;
662+
const char *query = "SELECT pg_catalog.pg_is_in_recovery()";
663+
int ntups;
664+
665+
res = PQexec(g_conn, query);
666+
check_sql_result(res, g_conn, query, PGRES_TUPLES_OK);
667+
ntups = PQntuples(res);
668+
669+
if (ntups != 1)
670+
{
671+
write_msg(NULL, ngettext("query returned %d row instead of one: %s\n",
672+
"query returned %d rows instead of one: %s\n",
673+
ntups),
674+
ntups, query);
675+
exit_nicely();
676+
}
677+
662678
if (strcmp(PQgetvalue(res, 0, 0), "t") == 0)
663679
{
664680
/*

0 commit comments

Comments
 (0)