aboutsummaryrefslogtreecommitdiff
path: root/contrib/postgres_fdw/postgres_fdw.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.c')
-rw-r--r--contrib/postgres_fdw/postgres_fdw.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index 25b287be069..456b267f70b 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -1704,7 +1704,7 @@ postgresReScanForeignScan(ForeignScanState *node)
res = pgfdw_exec_query(fsstate->conn, sql, fsstate->conn_state);
if (PQresultStatus(res) != PGRES_COMMAND_OK)
- pgfdw_report_error(ERROR, res, fsstate->conn, sql);
+ pgfdw_report_error(res, fsstate->conn, sql);
PQclear(res);
/* Now force a fresh FETCH. */
@@ -3614,7 +3614,7 @@ get_remote_estimate(const char *sql, PGconn *conn,
*/
res = pgfdw_exec_query(conn, sql, NULL);
if (PQresultStatus(res) != PGRES_TUPLES_OK)
- pgfdw_report_error(ERROR, res, conn, sql);
+ pgfdw_report_error(res, conn, sql);
/*
* Extract cost numbers for topmost plan node. Note we search for a left
@@ -3769,14 +3769,14 @@ create_cursor(ForeignScanState *node)
*/
if (!PQsendQueryParams(conn, buf.data, numParams,
NULL, values, NULL, NULL, 0))
- pgfdw_report_error(ERROR, NULL, conn, buf.data);
+ pgfdw_report_error(NULL, conn, buf.data);
/*
* Get the result, and check for success.
*/
res = pgfdw_get_result(conn);
if (PQresultStatus(res) != PGRES_COMMAND_OK)
- pgfdw_report_error(ERROR, res, conn, fsstate->query);
+ pgfdw_report_error(res, conn, fsstate->query);
PQclear(res);
/* Mark the cursor as created, and show no tuples have been retrieved */
@@ -3823,7 +3823,7 @@ fetch_more_data(ForeignScanState *node)
res = pgfdw_get_result(conn);
/* On error, report the original query, not the FETCH. */
if (PQresultStatus(res) != PGRES_TUPLES_OK)
- pgfdw_report_error(ERROR, res, conn, fsstate->query);
+ pgfdw_report_error(res, conn, fsstate->query);
/* Reset per-connection state */
fsstate->conn_state->pendingAreq = NULL;
@@ -3839,7 +3839,7 @@ fetch_more_data(ForeignScanState *node)
res = pgfdw_exec_query(conn, sql, fsstate->conn_state);
/* On error, report the original query, not the FETCH. */
if (PQresultStatus(res) != PGRES_TUPLES_OK)
- pgfdw_report_error(ERROR, res, conn, fsstate->query);
+ pgfdw_report_error(res, conn, fsstate->query);
}
/* Convert the data into HeapTuples */
@@ -3944,7 +3944,7 @@ close_cursor(PGconn *conn, unsigned int cursor_number,
snprintf(sql, sizeof(sql), "CLOSE c%u", cursor_number);
res = pgfdw_exec_query(conn, sql, conn_state);
if (PQresultStatus(res) != PGRES_COMMAND_OK)
- pgfdw_report_error(ERROR, res, conn, sql);
+ pgfdw_report_error(res, conn, sql);
PQclear(res);
}
@@ -4152,7 +4152,7 @@ execute_foreign_modify(EState *estate,
NULL,
NULL,
0))
- pgfdw_report_error(ERROR, NULL, fmstate->conn, fmstate->query);
+ pgfdw_report_error(NULL, fmstate->conn, fmstate->query);
/*
* Get the result, and check for success.
@@ -4160,7 +4160,7 @@ execute_foreign_modify(EState *estate,
res = pgfdw_get_result(fmstate->conn);
if (PQresultStatus(res) !=
(fmstate->has_returning ? PGRES_TUPLES_OK : PGRES_COMMAND_OK))
- pgfdw_report_error(ERROR, res, fmstate->conn, fmstate->query);
+ pgfdw_report_error(res, fmstate->conn, fmstate->query);
/* Check number of rows affected, and fetch RETURNING tuple if any */
if (fmstate->has_returning)
@@ -4219,14 +4219,14 @@ prepare_foreign_modify(PgFdwModifyState *fmstate)
fmstate->query,
0,
NULL))
- pgfdw_report_error(ERROR, NULL, fmstate->conn, fmstate->query);
+ pgfdw_report_error(NULL, fmstate->conn, fmstate->query);
/*
* Get the result, and check for success.
*/
res = pgfdw_get_result(fmstate->conn);
if (PQresultStatus(res) != PGRES_COMMAND_OK)
- pgfdw_report_error(ERROR, res, fmstate->conn, fmstate->query);
+ pgfdw_report_error(res, fmstate->conn, fmstate->query);
PQclear(res);
/* This action shows that the prepare has been done. */
@@ -4373,7 +4373,7 @@ deallocate_query(PgFdwModifyState *fmstate)
snprintf(sql, sizeof(sql), "DEALLOCATE %s", fmstate->p_name);
res = pgfdw_exec_query(fmstate->conn, sql, fmstate->conn_state);
if (PQresultStatus(res) != PGRES_COMMAND_OK)
- pgfdw_report_error(ERROR, res, fmstate->conn, sql);
+ pgfdw_report_error(res, fmstate->conn, sql);
PQclear(res);
pfree(fmstate->p_name);
fmstate->p_name = NULL;
@@ -4541,7 +4541,7 @@ execute_dml_stmt(ForeignScanState *node)
*/
if (!PQsendQueryParams(dmstate->conn, dmstate->query, numParams,
NULL, values, NULL, NULL, 0))
- pgfdw_report_error(ERROR, NULL, dmstate->conn, dmstate->query);
+ pgfdw_report_error(NULL, dmstate->conn, dmstate->query);
/*
* Get the result, and check for success.
@@ -4549,7 +4549,7 @@ execute_dml_stmt(ForeignScanState *node)
dmstate->result = pgfdw_get_result(dmstate->conn);
if (PQresultStatus(dmstate->result) !=
(dmstate->has_returning ? PGRES_TUPLES_OK : PGRES_COMMAND_OK))
- pgfdw_report_error(ERROR, dmstate->result, dmstate->conn,
+ pgfdw_report_error(dmstate->result, dmstate->conn,
dmstate->query);
/*
@@ -4923,7 +4923,7 @@ postgresAnalyzeForeignTable(Relation relation,
res = pgfdw_exec_query(conn, sql.data, NULL);
if (PQresultStatus(res) != PGRES_TUPLES_OK)
- pgfdw_report_error(ERROR, res, conn, sql.data);
+ pgfdw_report_error(res, conn, sql.data);
if (PQntuples(res) != 1 || PQnfields(res) != 1)
elog(ERROR, "unexpected result from deparseAnalyzeSizeSql query");
@@ -4972,7 +4972,7 @@ postgresGetAnalyzeInfoForForeignTable(Relation relation, bool *can_tablesample)
res = pgfdw_exec_query(conn, sql.data, NULL);
if (PQresultStatus(res) != PGRES_TUPLES_OK)
- pgfdw_report_error(ERROR, res, conn, sql.data);
+ pgfdw_report_error(res, conn, sql.data);
if (PQntuples(res) != 1 || PQnfields(res) != 2)
elog(ERROR, "unexpected result from deparseAnalyzeInfoSql query");
@@ -5018,7 +5018,7 @@ postgresAcquireSampleRowsFunc(Relation relation, int elevel,
int server_version_num;
PgFdwSamplingMethod method = ANALYZE_SAMPLE_AUTO; /* auto is default */
double sample_frac = -1.0;
- double reltuples;
+ double reltuples = -1.0;
unsigned int cursor_number;
StringInfoData sql;
PGresult *res;
@@ -5202,7 +5202,7 @@ postgresAcquireSampleRowsFunc(Relation relation, int elevel,
res = pgfdw_exec_query(conn, sql.data, NULL);
if (PQresultStatus(res) != PGRES_COMMAND_OK)
- pgfdw_report_error(ERROR, res, conn, sql.data);
+ pgfdw_report_error(res, conn, sql.data);
PQclear(res);
/*
@@ -5254,7 +5254,7 @@ postgresAcquireSampleRowsFunc(Relation relation, int elevel,
res = pgfdw_exec_query(conn, fetch_sql, NULL);
/* On error, report the original query, not the FETCH. */
if (PQresultStatus(res) != PGRES_TUPLES_OK)
- pgfdw_report_error(ERROR, res, conn, sql.data);
+ pgfdw_report_error(res, conn, sql.data);
/* Process whatever we got. */
numrows = PQntuples(res);
@@ -5426,7 +5426,7 @@ postgresImportForeignSchema(ImportForeignSchemaStmt *stmt, Oid serverOid)
res = pgfdw_exec_query(conn, buf.data, NULL);
if (PQresultStatus(res) != PGRES_TUPLES_OK)
- pgfdw_report_error(ERROR, res, conn, buf.data);
+ pgfdw_report_error(res, conn, buf.data);
if (PQntuples(res) != 1)
ereport(ERROR,
@@ -5540,7 +5540,7 @@ postgresImportForeignSchema(ImportForeignSchemaStmt *stmt, Oid serverOid)
/* Fetch the data */
res = pgfdw_exec_query(conn, buf.data, NULL);
if (PQresultStatus(res) != PGRES_TUPLES_OK)
- pgfdw_report_error(ERROR, res, conn, buf.data);
+ pgfdw_report_error(res, conn, buf.data);
/* Process results */
numrows = PQntuples(res);
@@ -7312,7 +7312,7 @@ postgresForeignAsyncNotify(AsyncRequest *areq)
/* On error, report the original query, not the FETCH. */
if (!PQconsumeInput(fsstate->conn))
- pgfdw_report_error(ERROR, NULL, fsstate->conn, fsstate->query);
+ pgfdw_report_error(NULL, fsstate->conn, fsstate->query);
fetch_more_data(node);
@@ -7411,7 +7411,7 @@ fetch_more_data_begin(AsyncRequest *areq)
fsstate->fetch_size, fsstate->cursor_number);
if (!PQsendQuery(fsstate->conn, sql))
- pgfdw_report_error(ERROR, NULL, fsstate->conn, fsstate->query);
+ pgfdw_report_error(NULL, fsstate->conn, fsstate->query);
/* Remember that the request is in process */
fsstate->conn_state->pendingAreq = areq;