Skip to content

Commit efbbbbc

Browse files
committed
Remove the unused argument of PSQLexec().
This commit simply removes the second argument of PSQLexec that was set to the same value everywhere. Comments and code blocks related to this parameter are removed. Noticed by Heikki Linnakangas, reviewed by Michael Paquier
1 parent 5ac372f commit efbbbbc

File tree

5 files changed

+65
-84
lines changed

5 files changed

+65
-84
lines changed

src/bin/psql/command.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ exec_command(const char *cmd,
967967
printfPQExpBuffer(&buf, "ALTER USER %s PASSWORD ",
968968
fmtId(user));
969969
appendStringLiteralConn(&buf, encrypted_password, pset.db);
970-
res = PSQLexec(buf.data, false);
970+
res = PSQLexec(buf.data);
971971
termPQExpBuffer(&buf);
972972
if (!res)
973973
success = false;
@@ -2181,7 +2181,7 @@ process_file(char *filename, bool single_txn, bool use_relative_path)
21812181

21822182
if (single_txn)
21832183
{
2184-
if ((res = PSQLexec("BEGIN", false)) == NULL)
2184+
if ((res = PSQLexec("BEGIN")) == NULL)
21852185
{
21862186
if (pset.on_error_stop)
21872187
{
@@ -2197,7 +2197,7 @@ process_file(char *filename, bool single_txn, bool use_relative_path)
21972197

21982198
if (single_txn)
21992199
{
2200-
if ((res = PSQLexec("COMMIT", false)) == NULL)
2200+
if ((res = PSQLexec("COMMIT")) == NULL)
22012201
{
22022202
if (pset.on_error_stop)
22032203
{

src/bin/psql/common.c

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -426,18 +426,14 @@ AcceptResult(const PGresult *result)
426426
* This is the way to send "backdoor" queries (those not directly entered
427427
* by the user). It is subject to -E but not -e.
428428
*
429-
* In autocommit-off mode, a new transaction block is started if start_xact
430-
* is true; nothing special is done when start_xact is false. Typically,
431-
* start_xact = false is used for SELECTs and explicit BEGIN/COMMIT commands.
432-
*
433429
* Caller is responsible for handling the ensuing processing if a COPY
434430
* command is sent.
435431
*
436432
* Note: we don't bother to check PQclientEncoding; it is assumed that no
437433
* caller uses this path to issue "SET CLIENT_ENCODING".
438434
*/
439435
PGresult *
440-
PSQLexec(const char *query, bool start_xact)
436+
PSQLexec(const char *query)
441437
{
442438
PGresult *res;
443439

@@ -468,21 +464,6 @@ PSQLexec(const char *query, bool start_xact)
468464

469465
SetCancelConn();
470466

471-
if (start_xact &&
472-
!pset.autocommit &&
473-
PQtransactionStatus(pset.db) == PQTRANS_IDLE)
474-
{
475-
res = PQexec(pset.db, "BEGIN");
476-
if (PQresultStatus(res) != PGRES_COMMAND_OK)
477-
{
478-
psql_error("%s", PQerrorMessage(pset.db));
479-
PQclear(res);
480-
ResetCancelConn();
481-
return NULL;
482-
}
483-
PQclear(res);
484-
}
485-
486467
res = PQexec(pset.db, query);
487468

488469
ResetCancelConn();

src/bin/psql/common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extern void setup_cancel_handler(void);
3838
extern void SetCancelConn(void);
3939
extern void ResetCancelConn(void);
4040

41-
extern PGresult *PSQLexec(const char *query, bool start_xact);
41+
extern PGresult *PSQLexec(const char *query);
4242
extern int PSQLexecWatch(const char *query, const printQueryOpt *opt);
4343

4444
extern bool SendQuery(const char *query);

0 commit comments

Comments
 (0)