Skip to content

Commit dd24098

Browse files
author
Etsuro Fujita
committed
postgres_fdw: Remove useless ternary expression.
There is no case where we would call pgfdw_exec_cleanup_query or pgfdw_exec_cleanup_query_{begin,end} with a NULL query string, so this expression is pointless; remove it and instead add to the latter functions an assertion ensuring the given query string is not NULL. Thinko in commit 815d61f. Discussion: https://postgr.es/m/CAPmGK14mm%2B%3DUjyjoWj_Hu7c%2BQqX-058RFfF%2BqOkcMZ_Nj52v-A%40mail.gmail.com
1 parent 3a4a353 commit dd24098

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

contrib/postgres_fdw/connection.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,8 @@ pgfdw_exec_cleanup_query(PGconn *conn, const char *query, bool ignore_errors)
14171417
static bool
14181418
pgfdw_exec_cleanup_query_begin(PGconn *conn, const char *query)
14191419
{
1420+
Assert(query != NULL);
1421+
14201422
/*
14211423
* Submit a query. Since we don't use non-blocking mode, this also can
14221424
* block. But its risk is relatively small, so we ignore that for now.
@@ -1438,6 +1440,8 @@ pgfdw_exec_cleanup_query_end(PGconn *conn, const char *query,
14381440
PGresult *result = NULL;
14391441
bool timed_out;
14401442

1443+
Assert(query != NULL);
1444+
14411445
/*
14421446
* If requested, consume whatever data is available from the socket. (Note
14431447
* that if all data is available, this allows pgfdw_get_cleanup_result to
@@ -1456,7 +1460,7 @@ pgfdw_exec_cleanup_query_end(PGconn *conn, const char *query,
14561460
if (timed_out)
14571461
ereport(WARNING,
14581462
(errmsg("could not get query result due to timeout"),
1459-
query ? errcontext("remote SQL command: %s", query) : 0));
1463+
errcontext("remote SQL command: %s", query)));
14601464
else
14611465
pgfdw_report_error(WARNING, NULL, conn, false, query);
14621466

0 commit comments

Comments
 (0)