From 48d911b3ab7209d4b844d0403bd70e804e2c57ce Mon Sep 17 00:00:00 2001 From: Josh Kupershmidt Date: Sat, 20 Oct 2012 17:15:17 -0700 Subject: [PATCH] Switch to using pgut_command() and pgut_execute() for conn2. --- bin/pg_reorg.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/pg_reorg.c b/bin/pg_reorg.c index e11eca3..39e2414 100755 --- a/bin/pg_reorg.c +++ b/bin/pg_reorg.c @@ -434,13 +434,13 @@ reorg_one_table(const reorg_table *table, const char *orderby) command(sql.data, 0, NULL); command("COMMIT", 0, NULL); - PQclear(PQexec(conn2, "BEGIN ISOLATION LEVEL READ COMMITTED")); + pgut_command(conn2, "BEGIN ISOLATION LEVEL READ COMMITTED", 0, NULL); elog(DEBUG2, "Obtaining ACCESS SHARE lock for %s", table->target_name); /* XXX: table name escaping? */ printfStringInfo(&sql, "LOCK TABLE %s IN ACCESS SHARE MODE", table->target_name); - res = PQexec(conn2, sql.data); + res = pgut_execute(conn2, sql.data, 0, NULL); if (PQresultStatus(res) != PGRES_COMMAND_OK) { printf("%s", PQerrorMessage(conn2)); @@ -454,7 +454,7 @@ reorg_one_table(const reorg_table *table, const char *orderby) /* store the backend PID of our connection keeping an ACCESS SHARE lock on the target table. */ - res = PQexec(conn2, "SELECT pg_backend_pid()"); + res = pgut_execute(conn2, "SELECT pg_backend_pid()", 0, NULL); if (PQresultStatus(res) != PGRES_TUPLES_OK) { printf("%s", PQerrorMessage(conn2)); @@ -676,7 +676,7 @@ lock_exclusive(const char *relid, const char *lock_query, bool release_conn2) * lock. */ if (release_conn2) - PQclear(PQexec(conn2, "COMMIT")); + pgut_command(conn2, "COMMIT", 0, NULL); /* wait for a while to lock the table. */ wait_msec = Min(1000, i * 100); @@ -728,7 +728,7 @@ reorg_cleanup(bool fatal, void *userdata) /* Rollback current transaction */ if (conn2) - PQclear(PQexec(conn2, "ROLLBACK")); + pgut_command(conn2, "ROLLBACK", 0, NULL); if (connection) command("ROLLBACK", 0, NULL);