aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.c8
-rw-r--r--src/bin/pg_dump/pg_backup_db.c28
-rw-r--r--src/bin/pg_dump/pg_dump.c11
3 files changed, 32 insertions, 15 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index 0885cfeac22..92d83dd39c8 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.57 2002/09/04 20:31:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.58 2002/10/16 05:46:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -280,7 +280,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
/*
* If we can output the data, then restore it.
*/
- if (AH->PrintTocDataPtr !=NULL && (reqs & REQ_DATA) != 0)
+ if (AH->PrintTocDataPtr != NULL && (reqs & REQ_DATA) != 0)
{
#ifndef HAVE_LIBZ
if (AH->compression != 0)
@@ -304,11 +304,9 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
*/
if (!AH->CustomOutPtr)
write_msg(modulename, "WARNING: skipping large object restoration\n");
-
}
else
{
-
_disableTriggersIfNecessary(AH, te, ropt);
/*
@@ -362,11 +360,9 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
te = AH->toc->next;
while (te != AH->toc)
{
-
/* Is it table data? */
if (strcmp(te->desc, "TABLE DATA") == 0)
{
-
ahlog(AH, 2, "checking whether we loaded %s\n", te->tag);
reqs = _tocEntryRequired(te, ropt);
diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c
index e5572db01d7..1075c06053d 100644
--- a/src/bin/pg_dump/pg_backup_db.c
+++ b/src/bin/pg_dump/pg_backup_db.c
@@ -5,7 +5,7 @@
* Implements the basic DB functions used by the archiver.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.41 2002/09/07 16:14:33 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.42 2002/10/16 05:46:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,11 +61,15 @@ _check_database_version(ArchiveHandle *AH, bool ignoreVersion)
myversion = _parse_version(AH, PG_VERSION);
- res = PQexec(conn, "SELECT version();");
+ /*
+ * Autocommit could be off. We turn it off later but we have to check
+ * the database version first.
+ */
+
+ res = PQexec(conn, "BEGIN;SELECT version();");
if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK ||
PQntuples(res) != 1)
-
die_horribly(AH, modulename, "could not get version from server: %s", PQerrorMessage(conn));
remoteversion_str = PQgetvalue(res, 0, 0);
@@ -73,6 +77,12 @@ _check_database_version(ArchiveHandle *AH, bool ignoreVersion)
PQclear(res);
+ res = PQexec(conn, "COMMIT;");
+ if (!res ||
+ PQresultStatus(res) != PGRES_COMMAND_OK)
+ die_horribly(AH, modulename, "could not get version from server: %s", PQerrorMessage(conn));
+ PQclear(res);
+
AH->public.remoteVersion = remoteversion;
if (myversion != remoteversion
@@ -277,6 +287,18 @@ ConnectDatabase(Archive *AHX,
/* check for version mismatch */
_check_database_version(AH, ignoreVersion);
+ /* Turn autocommit on */
+ if (AH->public.remoteVersion >= 70300)
+ {
+ PGresult *res;
+
+ res = PQexec(AH->connection, "SET autocommit TO 'on'");
+ if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
+ die_horribly(AH, NULL, "SET autocommit TO 'on' failed: %s",
+ PQerrorMessage(AH->connection));
+ PQclear(res);
+ }
+
PQsetNoticeProcessor(AH->connection, notice_processor, NULL);
return AH->connection;
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 5f7bf54e01b..8c52fad99bf 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -22,7 +22,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.302 2002/10/09 16:20:25 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.303 2002/10/16 05:46:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -549,22 +549,21 @@ main(int argc, char **argv)
g_conn = ConnectDatabase(g_fout, dbname, pghost, pgport, username, force_password, ignore_version);
/*
- * Start serializable transaction to dump consistent data
+ * Start serializable transaction to dump consistent data.
*/
{
PGresult *res;
- res = PQexec(g_conn, "begin");
+ res = PQexec(g_conn, "BEGIN");
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
exit_horribly(g_fout, NULL, "BEGIN command failed: %s",
PQerrorMessage(g_conn));
-
PQclear(res);
- res = PQexec(g_conn, "set transaction isolation level serializable");
+
+ res = PQexec(g_conn, "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE");
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
exit_horribly(g_fout, NULL, "could not set transaction isolation level to serializable: %s",
PQerrorMessage(g_conn));
-
PQclear(res);
}