Skip to content

Commit 3606e0a

Browse files
schmiddydvarrazzo
authored andcommitted
Switch to using pgut_command() and pgut_execute() for conn2.
1 parent 78bae38 commit 3606e0a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

bin/pg_repack.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -446,13 +446,13 @@ repack_one_table(const repack_table *table, const char *orderby)
446446
command(sql.data, 0, NULL);
447447
command("COMMIT", 0, NULL);
448448

449-
PQclear(PQexec(conn2, "BEGIN ISOLATION LEVEL READ COMMITTED"));
449+
pgut_command(conn2, "BEGIN ISOLATION LEVEL READ COMMITTED", 0, NULL);
450450
elog(DEBUG2, "Obtaining ACCESS SHARE lock for %s", table->target_name);
451451

452452
/* XXX: table name escaping? */
453453
printfStringInfo(&sql, "LOCK TABLE %s IN ACCESS SHARE MODE",
454454
table->target_name);
455-
res = PQexec(conn2, sql.data);
455+
res = pgut_execute(conn2, sql.data, 0, NULL);
456456
if (PQresultStatus(res) != PGRES_COMMAND_OK)
457457
{
458458
printf("%s", PQerrorMessage(conn2));
@@ -466,7 +466,7 @@ repack_one_table(const repack_table *table, const char *orderby)
466466
/* store the backend PID of our connection keeping an ACCESS SHARE
467467
lock on the target table.
468468
*/
469-
res = PQexec(conn2, "SELECT pg_backend_pid()");
469+
res = pgut_execute(conn2, "SELECT pg_backend_pid()", 0, NULL);
470470
if (PQresultStatus(res) != PGRES_TUPLES_OK)
471471
{
472472
printf("%s", PQerrorMessage(conn2));
@@ -688,7 +688,7 @@ lock_exclusive(const char *relid, const char *lock_query, bool release_conn2)
688688
* lock.
689689
*/
690690
if (release_conn2)
691-
PQclear(PQexec(conn2, "COMMIT"));
691+
pgut_command(conn2, "COMMIT", 0, NULL);
692692

693693
/* wait for a while to lock the table. */
694694
wait_msec = Min(1000, i * 100);
@@ -740,7 +740,7 @@ repack_cleanup(bool fatal, void *userdata)
740740

741741
/* Rollback current transaction */
742742
if (conn2)
743-
PQclear(PQexec(conn2, "ROLLBACK"));
743+
pgut_command(conn2, "ROLLBACK", 0, NULL);
744744

745745
if (connection)
746746
command("ROLLBACK", 0, NULL);

0 commit comments

Comments
 (0)