Skip to content

Commit 3ac7e80

Browse files
committed
pg code style in postgres_fdw
1 parent 4a59a18 commit 3ac7e80

File tree

3 files changed

+36
-36
lines changed

3 files changed

+36
-36
lines changed

contrib/postgres_fdw/connection.c

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -368,21 +368,21 @@ static void
368368
do_sql_send_command(PGconn *conn, const char *sql)
369369
{
370370
if (PQsendQuery(conn, sql) != PGRES_COMMAND_OK) {
371-
PGresult *res = PQgetResult(conn);
371+
PGresult *res = PQgetResult(conn);
372372
pgfdw_report_error(ERROR, res, conn, true, sql);
373-
PQclear(res);
374-
}
373+
PQclear(res);
374+
}
375375
}
376376

377377
static void
378378
do_sql_wait_command(PGconn *conn, const char *sql)
379379
{
380-
PGresult *res;
381-
while ((res = PQgetResult(conn)) != NULL) {
382-
if (PQresultStatus(res) != PGRES_COMMAND_OK)
383-
pgfdw_report_error(ERROR, res, conn, true, sql);
384-
PQclear(res);
385-
}
380+
PGresult *res;
381+
while ((res = PQgetResult(conn)) != NULL) {
382+
if (PQresultStatus(res) != PGRES_COMMAND_OK)
383+
pgfdw_report_error(ERROR, res, conn, true, sql);
384+
PQclear(res);
385+
}
386386
}
387387

388388
/*
@@ -403,20 +403,20 @@ begin_remote_xact(ConnCacheEntry *entry)
403403
/* Start main transaction if we haven't yet */
404404
if (entry->xact_depth <= 0)
405405
{
406-
TransactionId gxid = GetTransactionManager()->GetGlobalTransactionId();
406+
TransactionId gxid = GetTransactionManager()->GetGlobalTransactionId();
407407
const char *sql;
408408

409409
elog(DEBUG3, "starting remote transaction on connection %p",
410410
entry->conn);
411411

412-
if (TransactionIdIsValid(gxid)) {
413-
char stmt[64];
414-
PGresult *res;
412+
if (TransactionIdIsValid(gxid)) {
413+
char stmt[64];
414+
PGresult *res;
415415

416-
snprintf(stmt, sizeof(stmt), "select public.dtm_join_transaction(%d)", gxid);
417-
res = PQexec(entry->conn, stmt);
418-
PQclear(res);
419-
}
416+
snprintf(stmt, sizeof(stmt), "select public.dtm_join_transaction(%d)", gxid);
417+
res = PQexec(entry->conn, stmt);
418+
PQclear(res);
419+
}
420420

421421
if (IsolationIsSerializable())
422422
sql = "START TRANSACTION ISOLATION LEVEL SERIALIZABLE";
@@ -607,7 +607,7 @@ pgfdw_xact_callback(XactEvent event, void *arg)
607607
case XACT_EVENT_PARALLEL_COMMIT:
608608
case XACT_EVENT_COMMIT:
609609
case XACT_EVENT_PREPARE:
610-
do_sql_wait_command(entry->conn, "COMMIT TRANSACTION");
610+
do_sql_wait_command(entry->conn, "COMMIT TRANSACTION");
611611
/*
612612
* If there were any errors in subtransactions, and we
613613
* made prepared statements, do a DEALLOCATE ALL to make
@@ -680,17 +680,17 @@ pgfdw_xact_callback(XactEvent event, void *arg)
680680
}
681681
}
682682

683-
if (event != XACT_EVENT_PARALLEL_PRE_COMMIT && event != XACT_EVENT_PRE_COMMIT) {
684-
/*
685-
* Regardless of the event type, we can now mark ourselves as out of the
686-
* transaction. (Note: if we are here during PRE_COMMIT or PRE_PREPARE,
687-
* this saves a useless scan of the hashtable during COMMIT or PREPARE.)
688-
*/
689-
xact_got_connection = false;
690-
691-
/* Also reset cursor numbering for next transaction */
692-
cursor_number = 0;
693-
}
683+
if (event != XACT_EVENT_PARALLEL_PRE_COMMIT && event != XACT_EVENT_PRE_COMMIT) {
684+
/*
685+
* Regardless of the event type, we can now mark ourselves as out of the
686+
* transaction. (Note: if we are here during PRE_COMMIT or PRE_PREPARE,
687+
* this saves a useless scan of the hashtable during COMMIT or PREPARE.)
688+
*/
689+
xact_got_connection = false;
690+
691+
/* Also reset cursor numbering for next transaction */
692+
cursor_number = 0;
693+
}
694694
}
695695

696696
/*

contrib/postgres_fdw/postgres_fdw--1.0.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ CREATE FOREIGN DATA WRAPPER postgres_fdw
1717
HANDLER postgres_fdw_handler
1818
VALIDATOR postgres_fdw_validator;
1919

20-
CREATE FUNCTION postgres_fdw_exec(relid oid, sql cstring)
21-
RETURNS void
20+
CREATE FUNCTION postgres_fdw_exec(relid oid, sql cstring)
21+
RETURNS void
2222
AS 'MODULE_PATHNAME'
2323
LANGUAGE C STRICT;

contrib/postgres_fdw/postgres_fdw.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3007,15 +3007,15 @@ conversion_error_callback(void *arg)
30073007
Datum
30083008
postgres_fdw_exec(PG_FUNCTION_ARGS)
30093009
{
3010-
Oid relid = PG_GETARG_OID(0);
3011-
char const* sql = PG_GETARG_CSTRING(1);
3010+
Oid relid = PG_GETARG_OID(0);
3011+
char const* sql = PG_GETARG_CSTRING(1);
30123012
Oid userid = GetUserId();
30133013
ForeignTable *table = GetForeignTable(relid);
30143014
ForeignServer *server = GetForeignServer(table->serverid);
30153015
UserMapping *user = GetUserMapping(userid, server->serverid);
3016-
PGconn* conn = GetConnection(server, user, false);
3017-
PGresult* res = PQexec(conn, sql);
3016+
PGconn* conn = GetConnection(server, user, false);
3017+
PGresult* res = PQexec(conn, sql);
30183018
PQclear(res);
30193019
ReleaseConnection(conn);
3020-
PG_RETURN_VOID();
3020+
PG_RETURN_VOID();
30213021
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy