*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
/*
* 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)
*/
if (!AH->CustomOutPtr)
write_msg(modulename, "WARNING: skipping large object restoration\n");
-
}
else
{
-
_disableTriggersIfNecessary(AH, te, 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);
* 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 $
*
*-------------------------------------------------------------------------
*/
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);
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
/* 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;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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);
}