Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtsuro Fujita2024-04-04 08:55:00 +0000
committerEtsuro Fujita2024-04-04 08:55:00 +0000
commitdd24098cd6fdd599dcee0cd379bb8bdb0c3710a4 (patch)
treef8ad22b2f160d86b3f5c7bc7bef598ddbcc450d7 /contrib/postgres_fdw
parent3a4a3537a999932642ba7a459900fe3c4f5cad02 (diff)
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 815d61fcd. Discussion: https://postgr.es/m/CAPmGK14mm%2B%3DUjyjoWj_Hu7c%2BQqX-058RFfF%2BqOkcMZ_Nj52v-A%40mail.gmail.com
Diffstat (limited to 'contrib/postgres_fdw')
-rw-r--r--contrib/postgres_fdw/connection.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/contrib/postgres_fdw/connection.c b/contrib/postgres_fdw/connection.c
index 2532e453c4e..e4595926641 100644
--- a/contrib/postgres_fdw/connection.c
+++ b/contrib/postgres_fdw/connection.c
@@ -1417,6 +1417,8 @@ pgfdw_exec_cleanup_query(PGconn *conn, const char *query, bool ignore_errors)
static bool
pgfdw_exec_cleanup_query_begin(PGconn *conn, const char *query)
{
+ Assert(query != NULL);
+
/*
* Submit a query. Since we don't use non-blocking mode, this also can
* 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,
PGresult *result = NULL;
bool timed_out;
+ Assert(query != NULL);
+
/*
* If requested, consume whatever data is available from the socket. (Note
* 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,
if (timed_out)
ereport(WARNING,
(errmsg("could not get query result due to timeout"),
- query ? errcontext("remote SQL command: %s", query) : 0));
+ errcontext("remote SQL command: %s", query)));
else
pgfdw_report_error(WARNING, NULL, conn, false, query);