diff options
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/pg_dump/pg_backup_archiver.c | 4 | ||||
| -rw-r--r-- | src/bin/pg_dump/pg_backup_db.c | 39 | ||||
| -rw-r--r-- | src/bin/pg_dump/pg_dumpall.c | 14 | ||||
| -rw-r--r-- | src/bin/psql/command.c | 8 | ||||
| -rw-r--r-- | src/bin/psql/tab-complete.c | 3 | ||||
| -rw-r--r-- | src/bin/scripts/clusterdb | 6 | ||||
| -rw-r--r-- | src/bin/scripts/createdb.c | 6 | ||||
| -rw-r--r-- | src/bin/scripts/createlang.c | 4 | ||||
| -rw-r--r-- | src/bin/scripts/createuser.c | 4 | ||||
| -rw-r--r-- | src/bin/scripts/dropdb.c | 4 | ||||
| -rw-r--r-- | src/bin/scripts/droplang.c | 5 | ||||
| -rw-r--r-- | src/bin/scripts/dropuser.c | 4 | ||||
| -rw-r--r-- | src/bin/scripts/vacuumdb | 4 |
13 files changed, 26 insertions, 79 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index df8e09c3d2..9afbdfe07f 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.71 2003/05/03 22:18:59 tgl Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.72 2003/05/14 03:26:02 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -206,7 +206,6 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt) sav = SetOutput(AH, ropt->filename, ropt->compression); ahprintf(AH, "--\n-- PostgreSQL database dump\n--\n\n"); - ahprintf(AH, "SET autocommit TO 'on';\n\n"); /* * Drop the items at the start, in reverse order @@ -2122,7 +2121,6 @@ _reconnectAsUser(ArchiveHandle *AH, const char *dbname, const char *user) dbname ? fmtId(dbname) : "-"); appendPQExpBuffer(qry, " %s\n\n", fmtId(user)); - appendPQExpBuffer(qry, "SET autocommit TO 'on';\n\n"); ahprintf(AH, qry->data); diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c index 60771922e5..a154593863 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.46 2003/02/14 19:40:42 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.47 2003/05/14 03:26:02 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -61,12 +61,7 @@ _check_database_version(ArchiveHandle *AH, bool ignoreVersion) myversion = _parse_version(AH, PG_VERSION); - /* - * Autocommit could be off. We turn it on later but we have to check - * the database version first. - */ - - res = PQexec(conn, "BEGIN;SELECT version();"); + res = PQexec(conn, "SELECT version();"); if (!res || PQresultStatus(res) != PGRES_TUPLES_OK || PQntuples(res) != 1) @@ -77,12 +72,6 @@ _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 @@ -216,18 +205,6 @@ _connectDB(ArchiveHandle *AH, const char *reqdb, const char *requser) /* check for version mismatch */ _check_database_version(AH, true); - /* 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(newConn, notice_processor, NULL); return newConn; @@ -301,18 +278,6 @@ 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_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index f3919048f8..f9db6dfdec 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.17 2003/04/04 20:42:12 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.18 2003/05/14 03:26:02 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -188,7 +188,6 @@ main(int argc, char *argv[]) printf("-- PostgreSQL database cluster dump\n"); printf("--\n\n"); printf("\\connect \"template1\"\n\n"); - printf("SET autocommit TO 'on';\n\n"); dumpUsers(conn); dumpGroups(conn); @@ -550,8 +549,7 @@ dumpDatabases(PGconn *conn) if (verbose) fprintf(stderr, _("%s: dumping database \"%s\"...\n"), progname, dbname); - printf("\\connect %s\n", fmtId(dbname)); - printf("SET autocommit TO 'on';\n\n"); + printf("\\connect %s\n\n", fmtId(dbname)); ret = runPgDump(dbname); if (ret != 0) { @@ -677,14 +675,6 @@ connectDatabase(const char *dbname, const char *pghost, const char *pgport, } PQclear(res); - if (server_version >= 70300) - { - PGresult *res; - - res = executeQuery(conn, "SET autocommit TO 'on';SELECT 1;"); - PQclear(res); - } - return conn; } diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 199b86d004..fd6193dd24 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -3,7 +3,7 @@ * * Copyright 2000-2002 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.95 2003/04/04 20:40:45 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.96 2003/05/14 03:26:02 tgl Exp $ */ #include "postgres_fe.h" #include "command.h" @@ -1460,12 +1460,8 @@ test_superuser(const char *username) if (!username) return false; - /* - * Use begin/commit to avoid starting a transaction block if server - * has autocommit off by default. - */ initPQExpBuffer(&buf); - printfPQExpBuffer(&buf, "BEGIN; SELECT usesuper FROM pg_catalog.pg_user WHERE usename = '%s'; COMMIT", username); + printfPQExpBuffer(&buf, "SELECT usesuper FROM pg_catalog.pg_user WHERE usename = '%s'", username); res = PSQLexec(buf.data, true); termPQExpBuffer(&buf); diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 83ad4cd765..ea2295cca4 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -3,7 +3,7 @@ * * Copyright 2000-2002 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.76 2003/04/03 20:18:16 tgl Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.77 2003/05/14 03:26:02 tgl Exp $ */ /*---------------------------------------------------------------------- @@ -493,7 +493,6 @@ psql_completion(char *text, int start, int end) * backend/utils/misc/guc.c. */ "australian_timezones", - "autocommit", "client_encoding", "client_min_messages", "commit_delay", diff --git a/src/bin/scripts/clusterdb b/src/bin/scripts/clusterdb index 3532953104..f35393f96b 100644 --- a/src/bin/scripts/clusterdb +++ b/src/bin/scripts/clusterdb @@ -11,7 +11,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/clusterdb,v 1.10 2003/03/20 18:53:18 momjian Exp $ +# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/clusterdb,v 1.11 2003/05/14 03:26:03 tgl Exp $ # #------------------------------------------------------------------------- @@ -157,10 +157,10 @@ for db in $dbname do [ "$alldb" ] && echo "Clustering $db" if [ -z "$table" ]; then - ${PATHNAME}psql $PSQLOPT $ECHOOPT -c "SET autocommit TO 'on';CLUSTER" -d $db + ${PATHNAME}psql $PSQLOPT $ECHOOPT -c "CLUSTER" -d $db [ "$?" -ne 0 ] && exit 1 else - ${PATHNAME}psql $PSQLOPT $ECHOOPT -c "SET autocommit TO 'on';CLUSTER $table" -d $db + ${PATHNAME}psql $PSQLOPT $ECHOOPT -c "CLUSTER $table" -d $db [ "$?" -ne 0 ] && exit 1 fi done diff --git a/src/bin/scripts/createdb.c b/src/bin/scripts/createdb.c index 084bebbdd5..372ee922aa 100644 --- a/src/bin/scripts/createdb.c +++ b/src/bin/scripts/createdb.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/bin/scripts/createdb.c,v 1.1 2003/03/18 22:19:46 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/scripts/createdb.c,v 1.2 2003/05/14 03:26:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -143,7 +143,7 @@ main(int argc, char *argv[]) initPQExpBuffer(&sql); - appendPQExpBuffer(&sql, "SET autocommit TO on;\nCREATE DATABASE %s", + appendPQExpBuffer(&sql, "CREATE DATABASE %s", fmtId(dbname)); if (owner) @@ -181,7 +181,7 @@ main(int argc, char *argv[]) if (comment) { - printfPQExpBuffer(&sql, "SET autocommit TO on;\nCOMMENT ON DATABASE %s IS ", fmtId(dbname)); + printfPQExpBuffer(&sql, "COMMENT ON DATABASE %s IS ", fmtId(dbname)); appendStringLiteral(&sql, comment, false); appendPQExpBuffer(&sql, ";\n"); diff --git a/src/bin/scripts/createlang.c b/src/bin/scripts/createlang.c index ad562c7eb2..6ce9e8b167 100644 --- a/src/bin/scripts/createlang.c +++ b/src/bin/scripts/createlang.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/bin/scripts/createlang.c,v 1.1 2003/03/18 22:19:46 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/scripts/createlang.c,v 1.2 2003/05/14 03:26:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -237,7 +237,7 @@ main(int argc, char *argv[]) /* * Create the call handler and the language */ - printfPQExpBuffer(&sql, "SET autocommit TO on;\n"); + resetPQExpBuffer(&sql); if (!handlerexists) appendPQExpBuffer(&sql, diff --git a/src/bin/scripts/createuser.c b/src/bin/scripts/createuser.c index c67aebf9e2..e58952977d 100644 --- a/src/bin/scripts/createuser.c +++ b/src/bin/scripts/createuser.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/bin/scripts/createuser.c,v 1.1 2003/03/18 22:19:46 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/scripts/createuser.c,v 1.2 2003/05/14 03:26:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -185,7 +185,7 @@ main(int argc, char *argv[]) initPQExpBuffer(&sql); - printfPQExpBuffer(&sql, "SET autocommit TO on;\nCREATE USER %s", fmtId(newuser)); + printfPQExpBuffer(&sql, "CREATE USER %s", fmtId(newuser)); if (sysid) appendPQExpBuffer(&sql, " SYSID %s", sysid); if (encrypted == +1) diff --git a/src/bin/scripts/dropdb.c b/src/bin/scripts/dropdb.c index 784c7c252d..796930c415 100644 --- a/src/bin/scripts/dropdb.c +++ b/src/bin/scripts/dropdb.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/bin/scripts/dropdb.c,v 1.1 2003/03/18 22:19:46 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/scripts/dropdb.c,v 1.2 2003/05/14 03:26:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -113,7 +113,7 @@ main(int argc, char *argv[]) initPQExpBuffer(&sql); - appendPQExpBuffer(&sql, "SET autocommit TO on;\nDROP DATABASE %s;\n", + appendPQExpBuffer(&sql, "DROP DATABASE %s;\n", fmtId(dbname)); conn = connectDatabase("template1", host, port, username, password, progname); diff --git a/src/bin/scripts/droplang.c b/src/bin/scripts/droplang.c index 3b9701d6e0..d62ff24c1c 100644 --- a/src/bin/scripts/droplang.c +++ b/src/bin/scripts/droplang.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/bin/scripts/droplang.c,v 1.1 2003/03/18 22:19:47 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/scripts/droplang.c,v 1.2 2003/05/14 03:26:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -215,8 +215,7 @@ main(int argc, char *argv[]) /* * Drop the language */ - printfPQExpBuffer(&sql, "SET autocommit TO on;\n"); - appendPQExpBuffer(&sql, "DROP LANGUAGE \"%s\";\n", langname); + printfPQExpBuffer(&sql, "DROP LANGUAGE \"%s\";\n", langname); if (!keephandler) appendPQExpBuffer(&sql, "DROP FUNCTION \"%s\" ();\n", handler); if (echo) diff --git a/src/bin/scripts/dropuser.c b/src/bin/scripts/dropuser.c index df82f21c1b..6bc6359cd7 100644 --- a/src/bin/scripts/dropuser.c +++ b/src/bin/scripts/dropuser.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/bin/scripts/dropuser.c,v 1.1 2003/03/18 22:19:47 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/scripts/dropuser.c,v 1.2 2003/05/14 03:26:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -113,7 +113,7 @@ main(int argc, char *argv[]) } initPQExpBuffer(&sql); - appendPQExpBuffer(&sql, "SET autocommit TO on;\nDROP USER %s;\n", fmtId(dropuser)); + appendPQExpBuffer(&sql, "DROP USER %s;\n", fmtId(dropuser)); conn = connectDatabase("template1", host, port, username, password, progname); diff --git a/src/bin/scripts/vacuumdb b/src/bin/scripts/vacuumdb index 1a0e911455..f4c07f701e 100644 --- a/src/bin/scripts/vacuumdb +++ b/src/bin/scripts/vacuumdb @@ -12,7 +12,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.26 2002/10/18 22:05:36 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.27 2003/05/14 03:26:03 tgl Exp $ # #------------------------------------------------------------------------- @@ -172,7 +172,7 @@ fi for db in $dbname do [ "$alldb" -a "$quiet" -ne 1 ] && echo "Vacuuming $db" - ${PATHNAME}psql $PSQLOPT $ECHOOPT -c "SET autocommit TO 'on';VACUUM $full $verbose $analyze $table" -d $db + ${PATHNAME}psql $PSQLOPT $ECHOOPT -c "VACUUM $full $verbose $analyze $table" -d $db if [ "$?" -ne 0 ]; then echo "$CMDNAME: vacuum $table $db failed" 1>&2 exit 1 |
