From f85f43dfb5b9043ea6b01d8b824c195cd7f9ed3c Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 14 May 2003 03:26:03 +0000 Subject: [PATCH] Backend support for autocommit removed, per recent discussions. The only remnant of this failed experiment is that the server will take SET AUTOCOMMIT TO ON. Still TODO: provide some client-side autocommit logic in libpq. --- contrib/adddepend/adddepend | 11 +-- contrib/array/array_iterator.sql.in | 2 - contrib/btree_gist/btree_gist.sql.in | 2 - contrib/btree_gist/expected/btree_gist.out | 24 +++--- contrib/chkpass/chkpass.sql.in | 4 +- contrib/cube/cube.sql.in | 2 - contrib/cube/expected/cube.out | 4 +- contrib/dbase/dbf2pg.c | 2 - contrib/dblink/expected/dblink.out | 8 +- contrib/dblink/sql/dblink.sql | 9 +-- contrib/dbmirror/AddTrigger.sql | 2 - contrib/dbmirror/DBMirror.pl | 12 +-- contrib/dbmirror/MirrorSetup.sql | 2 - contrib/dbmirror/clean_pending.pl | 6 +- contrib/earthdistance/earthdistance.sql.in | 2 - .../earthdistance/expected/earthdistance.out | 4 +- contrib/findoidjoins/findoidjoins.c | 3 +- contrib/fulltextindex/fti.pl | 1 - contrib/fulltextindex/fti.sql.in | 2 - contrib/fulltextindex/uninstall.sql | 2 - contrib/fuzzystrmatch/fuzzystrmatch.sql.in | 2 - contrib/intagg/int_aggregate.sql.in | 2 - contrib/intarray/_int.sql.in | 2 - contrib/intarray/expected/_int.out | 4 +- contrib/isbn_issn/isbn_issn.sql.in | 6 +- contrib/lo/lo.sql.in | 4 +- contrib/lo/lo_drop.sql | 2 - contrib/ltree/expected/ltree.out | 16 ++-- contrib/ltree/ltree.sql.in | 2 - contrib/miscutil/misc_utils.sql.in | 2 - contrib/noupdate/noup.sql.in | 2 - contrib/oid2name/oid2name.c | 2 - contrib/pg_dumplo/main.c | 4 +- contrib/pgbench/pgbench.c | 9 +-- contrib/pgcrypto/pgcrypto.sql.in | 2 - contrib/pgstattuple/pgstattuple.sql.in | 2 - contrib/reindexdb/reindexdb | 10 +-- contrib/rtree_gist/bench/bench.pl | 7 -- contrib/rtree_gist/rtree_gist.sql.in | 2 - contrib/seg/expected/seg.out | 18 ++--- contrib/seg/seg.sql.in | 2 - contrib/spi/autoinc.sql.in | 2 - contrib/spi/insert_username.sql.in | 2 - contrib/spi/moddatetime.sql.in | 2 - contrib/spi/refint.sql.in | 2 - contrib/spi/timetravel.sql.in | 2 - contrib/tablefunc/tablefunc.sql.in | 2 - contrib/tsearch/expected/tsearch.out | 16 ++-- contrib/tsearch/tsearch.sql.in | 2 - contrib/userlock/user_locks.sql.in | 2 - contrib/vacuumlo/vacuumlo.c | 13 +-- contrib/xml/pgxml.sql.in | 2 - contrib/xml/pgxml_dom.sql.in | 2 - doc/src/sgml/libpq.sgml | 11 ++- doc/src/sgml/ref/begin.sgml | 8 +- doc/src/sgml/ref/psql-ref.sgml | 10 ++- doc/src/sgml/ref/set.sgml | 8 +- doc/src/sgml/ref/show.sgml | 8 +- doc/src/sgml/release.sgml | 4 +- doc/src/sgml/runtime.sgml | 52 +----------- src/backend/access/transam/xact.c | 80 +++---------------- src/backend/bootstrap/bootparse.y | 6 +- src/backend/bootstrap/bootstrap.c | 6 +- src/backend/catalog/namespace.c | 6 +- src/backend/commands/async.c | 10 +-- src/backend/commands/cluster.c | 10 +-- src/backend/commands/indexcmds.c | 11 ++- src/backend/commands/vacuum.c | 26 +++--- src/backend/tcop/postgres.c | 47 +++++------ src/backend/utils/init/postinit.c | 6 +- src/backend/utils/misc/guc.c | 25 +++++- src/backend/utils/misc/postgresql.conf.sample | 1 - src/bin/pg_dump/pg_backup_archiver.c | 4 +- src/bin/pg_dump/pg_backup_db.c | 39 +-------- src/bin/pg_dump/pg_dumpall.c | 14 +--- src/bin/psql/command.c | 8 +- src/bin/psql/tab-complete.c | 3 +- src/bin/scripts/clusterdb | 6 +- src/bin/scripts/createdb.c | 6 +- src/bin/scripts/createlang.c | 4 +- src/bin/scripts/createuser.c | 4 +- src/bin/scripts/dropdb.c | 4 +- src/bin/scripts/droplang.c | 5 +- src/bin/scripts/dropuser.c | 4 +- src/bin/scripts/vacuumdb | 4 +- src/include/access/xact.h | 6 +- src/test/regress/expected/alter_table.out | 1 - src/test/regress/expected/copy2.out | 1 - src/test/regress/expected/domain.out | 40 +++++----- src/test/regress/expected/oidjoins.out | 32 ++++++++ src/test/regress/expected/privileges.out | 4 - src/test/regress/expected/temp.out | 1 - src/test/regress/pg_regress.sh | 6 +- src/test/regress/sql/alter_table.sql | 1 - src/test/regress/sql/copy2.sql | 1 - src/test/regress/sql/domain.sql | 4 - src/test/regress/sql/oidjoins.sql | 16 ++++ src/test/regress/sql/privileges.sql | 4 - src/test/regress/sql/temp.sql | 1 - 99 files changed, 277 insertions(+), 536 deletions(-) diff --git a/contrib/adddepend/adddepend b/contrib/adddepend/adddepend index 5d743ced6eb..4fa8bc5d386 100755 --- a/contrib/adddepend/adddepend +++ b/contrib/adddepend/adddepend @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: adddepend,v 1.3 2002/12/02 00:28:29 tgl Exp $ +# $Id: adddepend,v 1.4 2003/05/14 03:25:55 tgl Exp $ # Project exists to assist PostgreSQL users with their structural upgrade # from 7.2 (or prior) to 7.3 (possibly later). Must be run against a 7.3 @@ -125,20 +125,13 @@ my $dbh = DBI->connect($dsn, $dbuser, $dbpass); # We want to control commits $dbh->{'AutoCommit'} = 0; -# turn on autocommit +# control where things get created my $sql = qq{ SET search_path = public; }; my $sth = $dbh->prepare($sql); $sth->execute(); -# turn on autocommit -my $sql2 = qq{ - SET autocommit TO 'on'; -}; -my $sth2 = $dbh->prepare($sql2); -$sth2->execute(); - END { $dbh->disconnect() if $dbh; } diff --git a/contrib/array/array_iterator.sql.in b/contrib/array/array_iterator.sql.in index cf3331a387b..4108a63eafd 100644 --- a/contrib/array/array_iterator.sql.in +++ b/contrib/array/array_iterator.sql.in @@ -6,8 +6,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE OR REPLACE FUNCTION array_texteq(_text, text) RETURNS bool AS 'MODULE_PATHNAME' diff --git a/contrib/btree_gist/btree_gist.sql.in b/contrib/btree_gist/btree_gist.sql.in index 4f0b1291df9..70db5a860da 100644 --- a/contrib/btree_gist/btree_gist.sql.in +++ b/contrib/btree_gist/btree_gist.sql.in @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - -- create type of int2 key CREATE FUNCTION int2key_in(cstring) RETURNS int2key diff --git a/contrib/btree_gist/expected/btree_gist.out b/contrib/btree_gist/expected/btree_gist.out index 3cd35992e44..497740062d3 100644 --- a/contrib/btree_gist/expected/btree_gist.out +++ b/contrib/btree_gist/expected/btree_gist.out @@ -3,18 +3,18 @@ -- does not depend on contents of btree_gist.sql. -- \set ECHO none -psql:btree_gist.sql:10: NOTICE: ProcedureCreate: type int2key is not yet defined -psql:btree_gist.sql:15: NOTICE: Argument type "int2key" is only a shell -psql:btree_gist.sql:27: NOTICE: ProcedureCreate: type int4key is not yet defined -psql:btree_gist.sql:32: NOTICE: Argument type "int4key" is only a shell -psql:btree_gist.sql:44: NOTICE: ProcedureCreate: type int8key is not yet defined -psql:btree_gist.sql:49: NOTICE: Argument type "int8key" is only a shell -psql:btree_gist.sql:61: NOTICE: ProcedureCreate: type float4key is not yet defined -psql:btree_gist.sql:66: NOTICE: Argument type "float4key" is only a shell -psql:btree_gist.sql:79: NOTICE: ProcedureCreate: type float8key is not yet defined -psql:btree_gist.sql:84: NOTICE: Argument type "float8key" is only a shell -psql:btree_gist.sql:394: NOTICE: ProcedureCreate: type tskey is not yet defined -psql:btree_gist.sql:399: NOTICE: Argument type "tskey" is only a shell +psql:btree_gist.sql:8: NOTICE: ProcedureCreate: type int2key is not yet defined +psql:btree_gist.sql:13: NOTICE: Argument type "int2key" is only a shell +psql:btree_gist.sql:25: NOTICE: ProcedureCreate: type int4key is not yet defined +psql:btree_gist.sql:30: NOTICE: Argument type "int4key" is only a shell +psql:btree_gist.sql:42: NOTICE: ProcedureCreate: type int8key is not yet defined +psql:btree_gist.sql:47: NOTICE: Argument type "int8key" is only a shell +psql:btree_gist.sql:59: NOTICE: ProcedureCreate: type float4key is not yet defined +psql:btree_gist.sql:64: NOTICE: Argument type "float4key" is only a shell +psql:btree_gist.sql:77: NOTICE: ProcedureCreate: type float8key is not yet defined +psql:btree_gist.sql:82: NOTICE: Argument type "float8key" is only a shell +psql:btree_gist.sql:392: NOTICE: ProcedureCreate: type tskey is not yet defined +psql:btree_gist.sql:397: NOTICE: Argument type "tskey" is only a shell CREATE TABLE int4tmp (b int4); \copy int4tmp from 'data/test_btree.data' CREATE TABLE int8tmp (b int8); diff --git a/contrib/chkpass/chkpass.sql.in b/contrib/chkpass/chkpass.sql.in index 231cf99a12c..418c016cf3d 100644 --- a/contrib/chkpass/chkpass.sql.in +++ b/contrib/chkpass/chkpass.sql.in @@ -4,7 +4,7 @@ -- darcy@druid.net -- http://www.druid.net/darcy/ -- --- $Header: /cvsroot/pgsql/contrib/chkpass/chkpass.sql.in,v 1.3 2002/10/18 18:41:19 momjian Exp $ +-- $Header: /cvsroot/pgsql/contrib/chkpass/chkpass.sql.in,v 1.4 2003/05/14 03:25:55 tgl Exp $ -- -- best viewed with tabs set to 4 -- @@ -16,8 +16,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE FUNCTION chkpass_in(cstring) RETURNS chkpass AS 'MODULE_PATHNAME' diff --git a/contrib/cube/cube.sql.in b/contrib/cube/cube.sql.in index e79eb5263c8..6afcce5aeba 100644 --- a/contrib/cube/cube.sql.in +++ b/contrib/cube/cube.sql.in @@ -4,8 +4,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE OR REPLACE FUNCTION cube_in(cstring) RETURNS cube AS 'MODULE_PATHNAME' diff --git a/contrib/cube/expected/cube.out b/contrib/cube/expected/cube.out index 3a1e670d66b..aeda8314d77 100644 --- a/contrib/cube/expected/cube.out +++ b/contrib/cube/expected/cube.out @@ -6,8 +6,8 @@ -- does not depend on contents of cube.sql. -- \set ECHO none -psql:cube.sql:12: NOTICE: ProcedureCreate: type cube is not yet defined -psql:cube.sql:17: NOTICE: Argument type "cube" is only a shell +psql:cube.sql:10: NOTICE: ProcedureCreate: type cube is not yet defined +psql:cube.sql:15: NOTICE: Argument type "cube" is only a shell -- -- testing the input and output functions -- diff --git a/contrib/dbase/dbf2pg.c b/contrib/dbase/dbf2pg.c index 5f673837258..b57b5c76885 100644 --- a/contrib/dbase/dbf2pg.c +++ b/contrib/dbase/dbf2pg.c @@ -861,8 +861,6 @@ main(int argc, char **argv) PQexec(conn, "SET search_path = public"); - PQexec(conn, "SET autocommit TO 'on'"); - /* Substitute field names */ do_substitute(subarg, dbh); diff --git a/contrib/dblink/expected/dblink.out b/contrib/dblink/expected/dblink.out index ed3a87cfa0e..945f1bd16a4 100644 --- a/contrib/dblink/expected/dblink.out +++ b/contrib/dblink/expected/dblink.out @@ -190,7 +190,7 @@ WHERE t.a > 7; ERROR: dblink: no connection available -- put more data into our slave table, first using arbitrary connection syntax -- but truncate the actual return value so we can use diff to check for success -SELECT substr(dblink_exec('dbname=regression','SET autocommit TO ''on'';INSERT INTO foo VALUES(10,''k'',''{"a10","b10","c10"}'')'),1,6); +SELECT substr(dblink_exec('dbname=regression','INSERT INTO foo VALUES(10,''k'',''{"a10","b10","c10"}'')'),1,6); substr -------- INSERT @@ -205,7 +205,7 @@ SELECT dblink_connect('dbname=regression'); -- put more data into our slave table, using persistent connection syntax -- but truncate the actual return value so we can use diff to check for success -SELECT substr(dblink_exec('SET autocommit TO ''on'';INSERT INTO foo VALUES(11,''l'',''{"a11","b11","c11"}'')'),1,6); +SELECT substr(dblink_exec('INSERT INTO foo VALUES(11,''l'',''{"a11","b11","c11"}'')'),1,6); substr -------- INSERT @@ -231,7 +231,7 @@ FROM dblink('SELECT * FROM foo') AS t(a int, b text, c text[]); (12 rows) -- change some data -SELECT dblink_exec('SET autocommit TO ''on'';UPDATE foo SET f3[2] = ''b99'' WHERE f1 = 11'); +SELECT dblink_exec('UPDATE foo SET f3[2] = ''b99'' WHERE f1 = 11'); dblink_exec ------------- UPDATE 1 @@ -247,7 +247,7 @@ WHERE a = 11; (1 row) -- delete some data -SELECT dblink_exec('SET autocommit TO ''on'';DELETE FROM foo WHERE f1 = 11'); +SELECT dblink_exec('DELETE FROM foo WHERE f1 = 11'); dblink_exec ------------- DELETE 1 diff --git a/contrib/dblink/sql/dblink.sql b/contrib/dblink/sql/dblink.sql index 4d534e50c1c..f041e0a770f 100644 --- a/contrib/dblink/sql/dblink.sql +++ b/contrib/dblink/sql/dblink.sql @@ -8,7 +8,6 @@ SET search_path = public; -- Turn off echoing so that expected file does not depend on -- contents of dblink.sql. \set ECHO none -SET autocommit TO 'on'; \i dblink.sql \set ECHO all @@ -113,21 +112,21 @@ WHERE t.a > 7; -- put more data into our slave table, first using arbitrary connection syntax -- but truncate the actual return value so we can use diff to check for success -SELECT substr(dblink_exec('dbname=regression','SET autocommit TO ''on'';INSERT INTO foo VALUES(10,''k'',''{"a10","b10","c10"}'')'),1,6); +SELECT substr(dblink_exec('dbname=regression','INSERT INTO foo VALUES(10,''k'',''{"a10","b10","c10"}'')'),1,6); -- create a persistent connection SELECT dblink_connect('dbname=regression'); -- put more data into our slave table, using persistent connection syntax -- but truncate the actual return value so we can use diff to check for success -SELECT substr(dblink_exec('SET autocommit TO ''on'';INSERT INTO foo VALUES(11,''l'',''{"a11","b11","c11"}'')'),1,6); +SELECT substr(dblink_exec('INSERT INTO foo VALUES(11,''l'',''{"a11","b11","c11"}'')'),1,6); -- let's see it SELECT * FROM dblink('SELECT * FROM foo') AS t(a int, b text, c text[]); -- change some data -SELECT dblink_exec('SET autocommit TO ''on'';UPDATE foo SET f3[2] = ''b99'' WHERE f1 = 11'); +SELECT dblink_exec('UPDATE foo SET f3[2] = ''b99'' WHERE f1 = 11'); -- let's see it SELECT * @@ -135,7 +134,7 @@ FROM dblink('SELECT * FROM foo') AS t(a int, b text, c text[]) WHERE a = 11; -- delete some data -SELECT dblink_exec('SET autocommit TO ''on'';DELETE FROM foo WHERE f1 = 11'); +SELECT dblink_exec('DELETE FROM foo WHERE f1 = 11'); -- let's see it SELECT * diff --git a/contrib/dbmirror/AddTrigger.sql b/contrib/dbmirror/AddTrigger.sql index de07c3ae00e..97150d3aa79 100644 --- a/contrib/dbmirror/AddTrigger.sql +++ b/contrib/dbmirror/AddTrigger.sql @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE TRIGGER "MyTableName_Trig" AFTER INSERT OR DELETE OR UPDATE ON "MyTableName" FOR EACH ROW EXECUTE PROCEDURE "recordchange" (); diff --git a/contrib/dbmirror/DBMirror.pl b/contrib/dbmirror/DBMirror.pl index a442502ba4e..7eeffd7f482 100755 --- a/contrib/dbmirror/DBMirror.pl +++ b/contrib/dbmirror/DBMirror.pl @@ -33,7 +33,7 @@ # # ############################################################################## -# $Id: DBMirror.pl,v 1.5 2002/12/05 21:03:51 momjian Exp $ +# $Id: DBMirror.pl,v 1.6 2003/05/14 03:25:55 tgl Exp $ # ############################################################################## @@ -135,15 +135,6 @@ sub Main() { die; } - my $setQuery2; - $setQuery2 = "SET autocommit TO 'on'"; - my $setResult2 = $masterConn->exec($setQuery2); - if($setResult2->resultStatus!=PGRES_COMMAND_OK) { - logErrorMessage($masterConn->errorMessage . "\n" . - $setQuery2); - die; - } - my $firstTime = 1; while(1) { if($firstTime == 0) { @@ -158,7 +149,6 @@ sub Main() { - sendQueryToSlaves(undef,"SET autocommit TO 'on'"); sendQueryToSlaves(undef,"SET TRANSACTION ISOLATION LEVEL SERIALIZABLE"); sendQueryToSlaves(undef,"SET CONSTRAINTS ALL DEFERRED"); diff --git a/contrib/dbmirror/MirrorSetup.sql b/contrib/dbmirror/MirrorSetup.sql index 7f54fa29672..4227ca5f396 100644 --- a/contrib/dbmirror/MirrorSetup.sql +++ b/contrib/dbmirror/MirrorSetup.sql @@ -1,6 +1,4 @@ -SET autocommit TO 'on'; - CREATE FUNCTION "recordchange" () RETURNS trigger AS '/usr/local/pgsql/lib/pending.so', 'recordchange' LANGUAGE 'C'; diff --git a/contrib/dbmirror/clean_pending.pl b/contrib/dbmirror/clean_pending.pl index a74ea24700b..9fba2610a11 100755 --- a/contrib/dbmirror/clean_pending.pl +++ b/contrib/dbmirror/clean_pending.pl @@ -16,7 +16,7 @@ # GNU General Public License for more details. # ############################################################################## -# $Id: clean_pending.pl,v 1.2 2002/10/18 18:41:19 momjian Exp $ +# $Id: clean_pending.pl,v 1.3 2003/05/14 03:25:55 tgl Exp $ ############################################################################## @@ -69,10 +69,6 @@ unless($dbConn->status == PGRES_CONNECTION_OK) { printf("Can't connect to database\n"); die; } -my $setresult = $dbConn->exec("SET autocommit TO 'on'"); -unless($setresult->resultStatus == PGRES_COMMAND_OK) { - die $dbConn->errorMessage; -} my $result = $dbConn->exec("BEGIN"); unless($result->resultStatus == PGRES_COMMAND_OK) { die $dbConn->errorMessage; diff --git a/contrib/earthdistance/earthdistance.sql.in b/contrib/earthdistance/earthdistance.sql.in index 6ee9a87b4ff..6520c6eb415 100644 --- a/contrib/earthdistance/earthdistance.sql.in +++ b/contrib/earthdistance/earthdistance.sql.in @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - -- The earth functions rely on contrib/cube having been installed and loaded. -- earth() returns the radius of the earth in meters. This is the only diff --git a/contrib/earthdistance/expected/earthdistance.out b/contrib/earthdistance/expected/earthdistance.out index 963c3b11b06..e1aadef9c74 100644 --- a/contrib/earthdistance/expected/earthdistance.out +++ b/contrib/earthdistance/expected/earthdistance.out @@ -6,8 +6,8 @@ -- does not depend on contents of earthdistance.sql or cube.sql. -- \set ECHO none -psql:../cube/cube.sql:12: NOTICE: ProcedureCreate: type cube is not yet defined -psql:../cube/cube.sql:17: NOTICE: Argument type "cube" is only a shell +psql:../cube/cube.sql:10: NOTICE: ProcedureCreate: type cube is not yet defined +psql:../cube/cube.sql:15: NOTICE: Argument type "cube" is only a shell -- -- The radius of the Earth we are using. -- diff --git a/contrib/findoidjoins/findoidjoins.c b/contrib/findoidjoins/findoidjoins.c index 464660bd13c..8eb27e42a51 100644 --- a/contrib/findoidjoins/findoidjoins.c +++ b/contrib/findoidjoins/findoidjoins.c @@ -3,7 +3,7 @@ * * Copyright 2002 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/contrib/findoidjoins/Attic/findoidjoins.c,v 1.19 2002/10/18 18:41:20 momjian Exp $ + * $Header: /cvsroot/pgsql/contrib/findoidjoins/Attic/findoidjoins.c,v 1.20 2003/05/14 03:25:56 tgl Exp $ */ #include "postgres_fe.h" @@ -49,7 +49,6 @@ main(int argc, char **argv) appendPQExpBuffer(&sql, "%s", "SET search_path = public;" - "SET autocommit TO 'on';" "SELECT c.relname, (SELECT nspname FROM " "pg_catalog.pg_namespace n WHERE n.oid = c.relnamespace) AS nspname " "FROM pg_catalog.pg_class c " diff --git a/contrib/fulltextindex/fti.pl b/contrib/fulltextindex/fti.pl index 60c7d97c6bd..17f000149b7 100644 --- a/contrib/fulltextindex/fti.pl +++ b/contrib/fulltextindex/fti.pl @@ -167,7 +167,6 @@ sub main { } PQexec($PG_CONN, "SET search_path = public"); - PQexec($PG_CONN, "SET autocommit TO 'on'"); PQexec($PG_CONN, "begin"); $query = "declare C cursor for select (\""; diff --git a/contrib/fulltextindex/fti.sql.in b/contrib/fulltextindex/fti.sql.in index d109aa9a107..93eff0f633d 100644 --- a/contrib/fulltextindex/fti.sql.in +++ b/contrib/fulltextindex/fti.sql.in @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE OR REPLACE FUNCTION fti() RETURNS trigger AS 'MODULE_PATHNAME', 'fti' LANGUAGE 'C' VOLATILE CALLED ON NULL INPUT; diff --git a/contrib/fulltextindex/uninstall.sql b/contrib/fulltextindex/uninstall.sql index 5a330546ab0..a06bab860f1 100644 --- a/contrib/fulltextindex/uninstall.sql +++ b/contrib/fulltextindex/uninstall.sql @@ -1,6 +1,4 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - DROP FUNCTION fti() CASCADE; diff --git a/contrib/fuzzystrmatch/fuzzystrmatch.sql.in b/contrib/fuzzystrmatch/fuzzystrmatch.sql.in index 3dc2888f40a..c548b8ba9f2 100644 --- a/contrib/fuzzystrmatch/fuzzystrmatch.sql.in +++ b/contrib/fuzzystrmatch/fuzzystrmatch.sql.in @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE FUNCTION levenshtein (text,text) RETURNS int AS 'MODULE_PATHNAME','levenshtein' diff --git a/contrib/intagg/int_aggregate.sql.in b/contrib/intagg/int_aggregate.sql.in index 8e929a60479..31279c5b33f 100644 --- a/contrib/intagg/int_aggregate.sql.in +++ b/contrib/intagg/int_aggregate.sql.in @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - -- Internal function for the aggregate -- Is called for each item in an aggregation CREATE OR REPLACE FUNCTION int_agg_state (int4, int4) diff --git a/contrib/intarray/_int.sql.in b/contrib/intarray/_int.sql.in index c75916507f6..21786e51e7a 100644 --- a/contrib/intarray/_int.sql.in +++ b/contrib/intarray/_int.sql.in @@ -6,8 +6,6 @@ -- opclasses get created. SET search_path = public; -SET autocommit TO 'on'; - -- Query type CREATE FUNCTION bqarr_in(cstring) RETURNS query_int diff --git a/contrib/intarray/expected/_int.out b/contrib/intarray/expected/_int.out index b29cf0b0ee0..b602df33d83 100644 --- a/contrib/intarray/expected/_int.out +++ b/contrib/intarray/expected/_int.out @@ -3,8 +3,8 @@ -- does not depend on contents of seg.sql. -- \set ECHO none -psql:_int.sql:15: NOTICE: ProcedureCreate: type query_int is not yet defined -psql:_int.sql:20: NOTICE: Argument type "query_int" is only a shell +psql:_int.sql:13: NOTICE: ProcedureCreate: type query_int is not yet defined +psql:_int.sql:18: NOTICE: Argument type "query_int" is only a shell SELECT intset(1234); intset -------- diff --git a/contrib/isbn_issn/isbn_issn.sql.in b/contrib/isbn_issn/isbn_issn.sql.in index fc9aef97ce8..d1130967f42 100644 --- a/contrib/isbn_issn/isbn_issn.sql.in +++ b/contrib/isbn_issn/isbn_issn.sql.in @@ -1,14 +1,12 @@ -- -- PostgreSQL code for ISSNs. -- --- $Id: isbn_issn.sql.in,v 1.7 2002/10/18 18:41:20 momjian Exp $ +-- $Id: isbn_issn.sql.in,v 1.8 2003/05/14 03:25:56 tgl Exp $ -- -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - -- -- Input and output functions and the type itself: -- @@ -124,7 +122,7 @@ CREATE OPERATOR <> ( -- -- PostgreSQL code for ISBNs. -- --- $Id: isbn_issn.sql.in,v 1.7 2002/10/18 18:41:20 momjian Exp $ +-- $Id: isbn_issn.sql.in,v 1.8 2003/05/14 03:25:56 tgl Exp $ -- -- -- Input and output functions and the type itself: diff --git a/contrib/lo/lo.sql.in b/contrib/lo/lo.sql.in index 68c0114a5f0..f043363301f 100644 --- a/contrib/lo/lo.sql.in +++ b/contrib/lo/lo.sql.in @@ -1,7 +1,7 @@ -- -- PostgreSQL code for LargeObjects -- --- $Id: lo.sql.in,v 1.9 2002/12/31 10:22:03 inoue Exp $ +-- $Id: lo.sql.in,v 1.10 2003/05/14 03:25:56 tgl Exp $ -- -- -- Create the data type @@ -12,8 +12,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE FUNCTION lo_in(cstring) RETURNS lo AS 'MODULE_PATHNAME' diff --git a/contrib/lo/lo_drop.sql b/contrib/lo/lo_drop.sql index d7f34f8bed5..c6c491b2c1f 100644 --- a/contrib/lo/lo_drop.sql +++ b/contrib/lo/lo_drop.sql @@ -6,8 +6,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - -- remove our test table DROP TABLE a; diff --git a/contrib/ltree/expected/ltree.out b/contrib/ltree/expected/ltree.out index 01246444f89..d856f0dbabc 100644 --- a/contrib/ltree/expected/ltree.out +++ b/contrib/ltree/expected/ltree.out @@ -1,12 +1,12 @@ \set ECHO none -psql:ltree.sql:9: NOTICE: ProcedureCreate: type ltree is not yet defined -psql:ltree.sql:14: NOTICE: Argument type "ltree" is only a shell -psql:ltree.sql:301: NOTICE: ProcedureCreate: type lquery is not yet defined -psql:ltree.sql:306: NOTICE: Argument type "lquery" is only a shell -psql:ltree.sql:412: NOTICE: ProcedureCreate: type ltxtquery is not yet defined -psql:ltree.sql:417: NOTICE: Argument type "ltxtquery" is only a shell -psql:ltree.sql:479: NOTICE: ProcedureCreate: type ltree_gist is not yet defined -psql:ltree.sql:484: NOTICE: Argument type "ltree_gist" is only a shell +psql:ltree.sql:7: NOTICE: ProcedureCreate: type ltree is not yet defined +psql:ltree.sql:12: NOTICE: Argument type "ltree" is only a shell +psql:ltree.sql:299: NOTICE: ProcedureCreate: type lquery is not yet defined +psql:ltree.sql:304: NOTICE: Argument type "lquery" is only a shell +psql:ltree.sql:410: NOTICE: ProcedureCreate: type ltxtquery is not yet defined +psql:ltree.sql:415: NOTICE: Argument type "ltxtquery" is only a shell +psql:ltree.sql:477: NOTICE: ProcedureCreate: type ltree_gist is not yet defined +psql:ltree.sql:482: NOTICE: Argument type "ltree_gist" is only a shell SELECT ''::ltree; ltree ------- diff --git a/contrib/ltree/ltree.sql.in b/contrib/ltree/ltree.sql.in index 2f267b9828a..7d8bdc35240 100644 --- a/contrib/ltree/ltree.sql.in +++ b/contrib/ltree/ltree.sql.in @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE FUNCTION ltree_in(cstring) RETURNS ltree AS 'MODULE_PATHNAME' diff --git a/contrib/miscutil/misc_utils.sql.in b/contrib/miscutil/misc_utils.sql.in index ddf32748137..b7e0a8b3671 100644 --- a/contrib/miscutil/misc_utils.sql.in +++ b/contrib/miscutil/misc_utils.sql.in @@ -13,8 +13,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE OR REPLACE FUNCTION backend_pid() RETURNS int4 AS 'MODULE_PATHNAME' diff --git a/contrib/noupdate/noup.sql.in b/contrib/noupdate/noup.sql.in index 47213779b46..32a047447f3 100644 --- a/contrib/noupdate/noup.sql.in +++ b/contrib/noupdate/noup.sql.in @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE OR REPLACE FUNCTION noup () RETURNS trigger AS 'MODULE_PATHNAME' diff --git a/contrib/oid2name/oid2name.c b/contrib/oid2name/oid2name.c index d6cb526a1a5..a5c18d761f8 100644 --- a/contrib/oid2name/oid2name.c +++ b/contrib/oid2name/oid2name.c @@ -247,8 +247,6 @@ sql_conn(const char *dbName, struct options * my_opts) sql_exec(conn, "SET search_path = public;", 0); - sql_exec(conn, "SET autocommit TO 'on';", 0); - /* return the conn if good */ return conn; } diff --git a/contrib/pg_dumplo/main.c b/contrib/pg_dumplo/main.c index e0758f35443..b6783c23efa 100644 --- a/contrib/pg_dumplo/main.c +++ b/contrib/pg_dumplo/main.c @@ -1,7 +1,7 @@ /* ------------------------------------------------------------------------- * pg_dumplo * - * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/main.c,v 1.15 2003/01/09 18:27:39 tgl Exp $ + * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/main.c,v 1.16 2003/05/14 03:25:56 tgl Exp $ * * Karel Zak 1999-2000 * ------------------------------------------------------------------------- @@ -191,8 +191,6 @@ main(int argc, char **argv) PQexec(pgLO->conn, "SET search_path = public"); - PQexec(pgLO->conn, "SET autocommit TO 'on'"); - PQexec(pgLO->conn, "BEGIN"); switch (pgLO->action) diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c index 1f64e9dc0e2..b41b8641b3c 100644 --- a/contrib/pgbench/pgbench.c +++ b/contrib/pgbench/pgbench.c @@ -1,5 +1,5 @@ /* - * $Header: /cvsroot/pgsql/contrib/pgbench/pgbench.c,v 1.22 2002/10/20 19:38:10 tgl Exp $ + * $Header: /cvsroot/pgsql/contrib/pgbench/pgbench.c,v 1.23 2003/05/14 03:25:56 tgl Exp $ * * pgbench: a simple TPC-B like benchmark program for PostgreSQL * written by Tatsuo Ishii @@ -147,13 +147,6 @@ doConnect() exit(1); } PQclear(res); - res = PQexec(con, "SET autocommit TO 'on'"); - if (PQresultStatus(res) != PGRES_COMMAND_OK) - { - fprintf(stderr, "%s", PQerrorMessage(con)); - exit(1); - } - PQclear(res); return (con); } diff --git a/contrib/pgcrypto/pgcrypto.sql.in b/contrib/pgcrypto/pgcrypto.sql.in index 0f3cbe537a0..31e1773a417 100644 --- a/contrib/pgcrypto/pgcrypto.sql.in +++ b/contrib/pgcrypto/pgcrypto.sql.in @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE OR REPLACE FUNCTION digest(text, text) RETURNS bytea AS 'MODULE_PATHNAME', 'pg_digest' diff --git a/contrib/pgstattuple/pgstattuple.sql.in b/contrib/pgstattuple/pgstattuple.sql.in index 5489c938121..c32c00ba3fe 100644 --- a/contrib/pgstattuple/pgstattuple.sql.in +++ b/contrib/pgstattuple/pgstattuple.sql.in @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - DROP TYPE pgstattuple_type CASCADE; CREATE TYPE pgstattuple_type AS ( table_len BIGINT, -- physical table length in bytes diff --git a/contrib/reindexdb/reindexdb b/contrib/reindexdb/reindexdb index f0dd79930a3..b1cea9201a6 100644 --- a/contrib/reindexdb/reindexdb +++ b/contrib/reindexdb/reindexdb @@ -1,6 +1,6 @@ #!/bin/sh # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # -# Package : reindexdb Version : $Revision: 1.3 $ +# Package : reindexdb Version : $Revision: 1.4 $ # Date : 05/08/2002 Author : Shaun Thomas # Req : psql, sh, perl, sed Type : Utility # @@ -193,11 +193,11 @@ fi # If index was set, reindex that index. if [ "$index" ]; then - $PSQL $PSQLOPT $ECHOOPT -c "SET autocommit TO 'on';REINDEX INDEX $index" -d $dbname + $PSQL $PSQLOPT $ECHOOPT -c "REINDEX INDEX $index" -d $dbname # Ok, no index. Is there a specific table to reindex? elif [ "$table" ]; then - $PSQL $PSQLOPT $ECHOOPT -c "SET autocommit TO 'on';REINDEX TABLE \"$table\"" -d $dbname + $PSQL $PSQLOPT $ECHOOPT -c "REINDEX TABLE \"$table\"" -d $dbname # No specific table, no specific index, either we have a specific database, # or were told to do all databases. Do it! @@ -213,9 +213,9 @@ else # Ok, reindex every table in the database. Use the same method # we used to get a list of databases, and get a list of tables in this # database that we may reindex. - tables=`$PSQL $PSQLOPT -q -t -A -d $db -c "SET autocommit TO 'on';$sql"` + tables=`$PSQL $PSQLOPT -q -t -A -d $db -c "$sql"` for tab in $tables; do - $PSQL $PSQLOPT $ECHOOPT -c "SET autocommit TO 'on';REINDEX TABLE \"$tab\"" -d $db + $PSQL $PSQLOPT $ECHOOPT -c "REINDEX TABLE \"$tab\"" -d $db done done diff --git a/contrib/rtree_gist/bench/bench.pl b/contrib/rtree_gist/bench/bench.pl index e42ec9c63a3..e73fd2671cd 100755 --- a/contrib/rtree_gist/bench/bench.pl +++ b/contrib/rtree_gist/bench/bench.pl @@ -32,13 +32,6 @@ my $setsql = qq{ my $sth = $dbi->prepare($setsql); $sth->execute(); -my $setsql2 = qq{ - SET autocommit TO 'on'; -}; - -my $sth2 = $dbi->prepare($setsql2); -$sth2->execute(); - my $sql; my $notice; my $sss = '(3000,3000,2990,2990)'; diff --git a/contrib/rtree_gist/rtree_gist.sql.in b/contrib/rtree_gist/rtree_gist.sql.in index f7ad2748bc2..c721694f390 100644 --- a/contrib/rtree_gist/rtree_gist.sql.in +++ b/contrib/rtree_gist/rtree_gist.sql.in @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - -- -- -- diff --git a/contrib/seg/expected/seg.out b/contrib/seg/expected/seg.out index bf075593c94..5c0c1fceaa8 100644 --- a/contrib/seg/expected/seg.out +++ b/contrib/seg/expected/seg.out @@ -6,8 +6,8 @@ -- does not depend on contents of seg.sql. -- \set ECHO none -psql:seg.sql:12: NOTICE: ProcedureCreate: type seg is not yet defined -psql:seg.sql:17: NOTICE: Argument type "seg" is only a shell +psql:seg.sql:10: NOTICE: ProcedureCreate: type seg is not yet defined +psql:seg.sql:15: NOTICE: Argument type "seg" is only a shell -- -- testing the input and output functions -- @@ -395,25 +395,25 @@ SELECT '100(+-)1'::seg AS seg; SELECT ''::seg AS seg; ERROR: seg_in: can't parse an empty string SELECT 'ABC'::seg AS seg; -ERROR: parse error at or near position 1, character ('A', \101), input: 'ABC' +ERROR: syntax error at or near position 1, character ('A', \101), input: 'ABC' SELECT '1ABC'::seg AS seg; -ERROR: parse error at or near position 2, character ('A', \101), input: '1ABC' +ERROR: syntax error at or near position 2, character ('A', \101), input: '1ABC' SELECT '1.'::seg AS seg; -ERROR: parse error at or near position 2, character ('.', \056), input: '1.' +ERROR: syntax error at or near position 2, character ('.', \056), input: '1.' SELECT '1.....'::seg AS seg; -ERROR: parse error at or near position 6, character ('.', \056), input: '1.....' +ERROR: syntax error at or near position 6, character ('.', \056), input: '1.....' SELECT '.1'::seg AS seg; -ERROR: parse error at or near position 2, character ('1', \061), input: '.1' +ERROR: syntax error at or near position 2, character ('1', \061), input: '.1' SELECT '1..2.'::seg AS seg; -ERROR: parse error at or near position 5, character ('.', \056), input: '1..2.' +ERROR: syntax error at or near position 5, character ('.', \056), input: '1..2.' SELECT '1 e7'::seg AS seg; -ERROR: parse error at or near position 3, character ('e', \145), input: '1 e7' +ERROR: syntax error at or near position 3, character ('e', \145), input: '1 e7' SELECT '1e700'::seg AS seg; ERROR: numeric value 1e700 unrepresentable diff --git a/contrib/seg/seg.sql.in b/contrib/seg/seg.sql.in index 42e2deec4bf..a1e7e0cf488 100644 --- a/contrib/seg/seg.sql.in +++ b/contrib/seg/seg.sql.in @@ -4,8 +4,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE FUNCTION seg_in(cstring) RETURNS seg AS 'MODULE_PATHNAME' diff --git a/contrib/spi/autoinc.sql.in b/contrib/spi/autoinc.sql.in index cec50b61895..75889b3786d 100644 --- a/contrib/spi/autoinc.sql.in +++ b/contrib/spi/autoinc.sql.in @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE OR REPLACE FUNCTION autoinc() RETURNS trigger AS 'MODULE_PATHNAME' diff --git a/contrib/spi/insert_username.sql.in b/contrib/spi/insert_username.sql.in index c8c67665799..3d096592d29 100644 --- a/contrib/spi/insert_username.sql.in +++ b/contrib/spi/insert_username.sql.in @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE OR REPLACE FUNCTION insert_username() RETURNS trigger AS 'MODULE_PATHNAME' diff --git a/contrib/spi/moddatetime.sql.in b/contrib/spi/moddatetime.sql.in index e89c37e6d52..9bdaa9aefe0 100644 --- a/contrib/spi/moddatetime.sql.in +++ b/contrib/spi/moddatetime.sql.in @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE OR REPLACE FUNCTION moddatetime() RETURNS trigger AS 'MODULE_PATHNAME' diff --git a/contrib/spi/refint.sql.in b/contrib/spi/refint.sql.in index 322de9521e5..14b135e2580 100644 --- a/contrib/spi/refint.sql.in +++ b/contrib/spi/refint.sql.in @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE OR REPLACE FUNCTION check_primary_key() RETURNS trigger AS 'MODULE_PATHNAME' diff --git a/contrib/spi/timetravel.sql.in b/contrib/spi/timetravel.sql.in index b297a23ec27..f20e9fedf64 100644 --- a/contrib/spi/timetravel.sql.in +++ b/contrib/spi/timetravel.sql.in @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE OR REPLACE FUNCTION timetravel() RETURNS trigger AS 'MODULE_PATHNAME' diff --git a/contrib/tablefunc/tablefunc.sql.in b/contrib/tablefunc/tablefunc.sql.in index 3055d9cab0f..3271d280649 100644 --- a/contrib/tablefunc/tablefunc.sql.in +++ b/contrib/tablefunc/tablefunc.sql.in @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE OR REPLACE FUNCTION normal_rand(int4, float8, float8, int4) RETURNS setof float8 AS 'MODULE_PATHNAME','normal_rand' diff --git a/contrib/tsearch/expected/tsearch.out b/contrib/tsearch/expected/tsearch.out index 91f28dd47d7..6b92d45f7ca 100644 --- a/contrib/tsearch/expected/tsearch.out +++ b/contrib/tsearch/expected/tsearch.out @@ -3,14 +3,14 @@ -- does not depend on contents of seg.sql. -- \set ECHO none -psql:tsearch.sql:11: NOTICE: ProcedureCreate: type txtidx is not yet defined -psql:tsearch.sql:16: NOTICE: Argument type "txtidx" is only a shell -psql:tsearch.sql:40: NOTICE: ProcedureCreate: type query_txt is not yet defined -psql:tsearch.sql:45: NOTICE: Argument type "query_txt" is only a shell -psql:tsearch.sql:57: NOTICE: ProcedureCreate: type mquery_txt is not yet defined -psql:tsearch.sql:63: NOTICE: Argument type "mquery_txt" is only a shell -psql:tsearch.sql:158: NOTICE: ProcedureCreate: type gtxtidx is not yet defined -psql:tsearch.sql:163: NOTICE: Argument type "gtxtidx" is only a shell +psql:tsearch.sql:9: NOTICE: ProcedureCreate: type txtidx is not yet defined +psql:tsearch.sql:14: NOTICE: Argument type "txtidx" is only a shell +psql:tsearch.sql:38: NOTICE: ProcedureCreate: type query_txt is not yet defined +psql:tsearch.sql:43: NOTICE: Argument type "query_txt" is only a shell +psql:tsearch.sql:55: NOTICE: ProcedureCreate: type mquery_txt is not yet defined +psql:tsearch.sql:61: NOTICE: Argument type "mquery_txt" is only a shell +psql:tsearch.sql:156: NOTICE: ProcedureCreate: type gtxtidx is not yet defined +psql:tsearch.sql:161: NOTICE: Argument type "gtxtidx" is only a shell --txtidx SELECT '1'::txtidx; txtidx diff --git a/contrib/tsearch/tsearch.sql.in b/contrib/tsearch/tsearch.sql.in index 4577fa02e8e..899b720eb64 100644 --- a/contrib/tsearch/tsearch.sql.in +++ b/contrib/tsearch/tsearch.sql.in @@ -1,8 +1,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - -- TXTIDX type CREATE FUNCTION txtidx_in(cstring) diff --git a/contrib/userlock/user_locks.sql.in b/contrib/userlock/user_locks.sql.in index 1826fcf2491..62689c55436 100644 --- a/contrib/userlock/user_locks.sql.in +++ b/contrib/userlock/user_locks.sql.in @@ -12,8 +12,6 @@ -- Adjust this setting to control where the objects get created. SET search_path = public; -SET autocommit TO 'on'; - CREATE OR REPLACE FUNCTION user_lock(int4,int4,int4) RETURNS int4 AS 'MODULE_PATHNAME' diff --git a/contrib/vacuumlo/vacuumlo.c b/contrib/vacuumlo/vacuumlo.c index 3d30f0b7b37..cc86e70ed5e 100644 --- a/contrib/vacuumlo/vacuumlo.c +++ b/contrib/vacuumlo/vacuumlo.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/contrib/vacuumlo/vacuumlo.c,v 1.19 2002/12/10 01:57:16 momjian Exp $ + * $Header: /cvsroot/pgsql/contrib/vacuumlo/vacuumlo.c,v 1.20 2003/05/14 03:25:57 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -218,17 +218,6 @@ vacuumlo(char *database, struct _param * param) } PQclear(res); - res = PQexec(conn, "SET autocommit TO 'on'"); - if (PQresultStatus(res) != PGRES_COMMAND_OK) - { - fprintf(stderr, "Failed to set autocommit on:\n"); - fprintf(stderr, "%s", PQerrorMessage(conn)); - PQclear(res); - PQfinish(conn); - return -1; - } - PQclear(res); - /* * First we create and populate the LO temp table */ diff --git a/contrib/xml/pgxml.sql.in b/contrib/xml/pgxml.sql.in index 0814baa5938..514643b936e 100644 --- a/contrib/xml/pgxml.sql.in +++ b/contrib/xml/pgxml.sql.in @@ -3,8 +3,6 @@ -- Adjust this setting to control where the objects get created. SET search_path TO public; -SET autocommit TO on; - CREATE OR REPLACE FUNCTION pgxml_parse(text) RETURNS boolean AS 'MODULE_PATHNAME' LANGUAGE c STRICT; diff --git a/contrib/xml/pgxml_dom.sql.in b/contrib/xml/pgxml_dom.sql.in index 0814baa5938..514643b936e 100644 --- a/contrib/xml/pgxml_dom.sql.in +++ b/contrib/xml/pgxml_dom.sql.in @@ -3,8 +3,6 @@ -- Adjust this setting to control where the objects get created. SET search_path TO public; -SET autocommit TO on; - CREATE OR REPLACE FUNCTION pgxml_parse(text) RETURNS boolean AS 'MODULE_PATHNAME' LANGUAGE c STRICT; diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index bff6f294f48..9bbf060c76e 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -1,5 +1,5 @@ @@ -866,8 +866,13 @@ returned by the server. maintain the PGresult abstraction. Use the accessor functions below to get at the contents of PGresult. Avoid directly referencing the fields of the PGresult structure because they are subject to change in the future. -If autocommit is on, multiple queries sent in a single -function call are processed in a single transaction. + + + +Multiple queries sent in a single +function call are processed in a single transaction, unless there are explicit +BEGIN/COMMIT commands included in the query string to divide it into multiple +transactions. diff --git a/doc/src/sgml/ref/begin.sgml b/doc/src/sgml/ref/begin.sgml index 1c5fe0f6ce8..7bd1309d289 100644 --- a/doc/src/sgml/ref/begin.sgml +++ b/doc/src/sgml/ref/begin.sgml @@ -1,5 +1,5 @@ @@ -98,12 +98,6 @@ BEGIN [ WORK | TRANSACTION ] to terminate a transaction. - - - If you turn the configuration parameter autocommit off, - then BEGIN is not required: any SQL command - automatically starts a transaction. - diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index 49e4f998da0..8dd25d572e4 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -1,5 +1,5 @@ @@ -88,9 +88,11 @@ PostgreSQL documentation select * from foo;" | psql. - If autocommit is on, multiple queries in a single - string are processed in a single transaction. - + If the command string contains multiple SQL commands, they are + processed in a single transaction, unless there are explicit + BEGIN/COMMIT commands included in the string to divide it into + multiple transactions. This is different from the behavior when + the same string is fed to psql's standard input. diff --git a/doc/src/sgml/ref/set.sgml b/doc/src/sgml/ref/set.sgml index eba67d05775..170afd13dae 100644 --- a/doc/src/sgml/ref/set.sgml +++ b/doc/src/sgml/ref/set.sgml @@ -1,5 +1,5 @@ @@ -55,12 +55,6 @@ SET [ SESSION | LOCAL ] TIME ZONE { timezoneSET value will take effect. - - - Even with autocommit set to off, SET - does not start a new transaction block. See the - autocommit section in for details. - diff --git a/doc/src/sgml/ref/show.sgml b/doc/src/sgml/ref/show.sgml index dd8e9cf0412..0232d97dfce 100644 --- a/doc/src/sgml/ref/show.sgml +++ b/doc/src/sgml/ref/show.sgml @@ -1,5 +1,5 @@ @@ -37,12 +37,6 @@ SHOW ALL postmaster. See for details. - - - Even with autocommit set to off, SHOW - does not start a new transaction block. See the - autocommit section in for details. - diff --git a/doc/src/sgml/release.sgml b/doc/src/sgml/release.sgml index 654b8b53c08..9332ac499b4 100644 --- a/doc/src/sgml/release.sgml +++ b/doc/src/sgml/release.sgml @@ -1,5 +1,5 @@ @@ -24,6 +24,8 @@ CDATA means the content is "SGML-free", so you can write without worries about funny characters. --> @@ -1289,56 +1289,6 @@ SET ENABLE_SEQSCAN TO OFF; General Operation - - AUTOCOMMIT (boolean) - autocommit - - - If set to true, PostgreSQL will - automatically do a COMMIT after each successful command - that is not inside an explicit transaction block (that is, unless a - BEGIN with no matching COMMIT has been - given). - If set to false, PostgreSQL will - commit only upon receiving an explicit - COMMIT command. This mode can also be thought of as - implicitly issuing BEGIN whenever a command is - received that is not already inside a transaction block. The - default is true, for compatibility with historical - PostgreSQL behavior. However, for - maximum compatibility with the SQL specification, set it to - false. - - - - - Even with autocommit set to false, SET, - SHOW, and RESET do not start new - transaction blocks. They are run in their own transactions. - Once another command is issued, a transaction block - begins and any SET, SHOW, or - RESET commands are considered to be part of the - transaction, i.e., they are committed or rolled back depending - on the completion status of the transaction. To execute a - SET, SHOW, or RESET - command at the start of a transaction block, use BEGIN - first. - - - - - - As of PostgreSQL 7.3, setting - autocommit to false is not well-supported. - This is a new feature and is not yet handled by all client - libraries and applications. Before making it the default - setting in your installation, test carefully. - - - - - - AUSTRALIAN_TIMEZONES (boolean) Australian time zones diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 59b43656d5f..455d637762e 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.147 2003/05/02 20:54:33 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.148 2003/05/14 03:26:00 tgl Exp $ * * NOTES * Transaction aborts can now occur two ways: @@ -212,15 +212,11 @@ int XactIsoLevel; bool DefaultXactReadOnly = false; bool XactReadOnly; -bool autocommit = true; - int CommitDelay = 0; /* precommit delay in microseconds */ int CommitSiblings = 5; /* number of concurrent xacts needed to * sleep */ -static bool suppressChain = false; - static void (*_RollbackFunc) (void *) = NULL; static void *_RollbackData = NULL; @@ -1125,23 +1121,12 @@ CleanupTransaction(void) /* * StartTransactionCommand - * - * preventChain, if true, forces autocommit behavior at the next - * CommitTransactionCommand call. */ void -StartTransactionCommand(bool preventChain) +StartTransactionCommand(void) { TransactionState s = CurrentTransactionState; - /* - * Remember if caller wants to prevent autocommit-off chaining. This - * is only allowed if not already in a transaction block. - */ - suppressChain = preventChain; - if (preventChain && s->blockState != TBLOCK_DEFAULT) - elog(ERROR, "StartTransactionCommand: can't prevent chain"); - switch (s->blockState) { /* @@ -1217,44 +1202,20 @@ StartTransactionCommand(bool preventChain) /* * CommitTransactionCommand - * - * forceCommit = true forces autocommit behavior even when autocommit is off. */ void -CommitTransactionCommand(bool forceCommit) +CommitTransactionCommand(void) { TransactionState s = CurrentTransactionState; switch (s->blockState) { /* - * If we aren't in a transaction block, and we are doing - * autocommit, just do our usual transaction commit. But if - * we aren't doing autocommit, start a transaction block - * automatically by switching to INPROGRESS state. (We handle - * this choice here, and not earlier, so that an explicit - * BEGIN issued in autocommit-off mode won't issue strange - * warnings.) - * - * Autocommit mode is forced by either a true forceCommit - * parameter to me, or a true preventChain parameter to the - * preceding StartTransactionCommand call, or a - * PreventTransactionChain call during the transaction. - * (The parameters could be omitted, but it turns out most - * callers of StartTransactionCommand/CommitTransactionCommand - * want to force autocommit, so making them all call - * PreventTransactionChain would just be extra notation.) + * If we aren't in a transaction block, just do our usual + * transaction commit. */ case TBLOCK_DEFAULT: - if (autocommit || forceCommit || suppressChain) - CommitTransaction(); - else - { - BeginTransactionBlock(); - Assert(s->blockState == TBLOCK_INPROGRESS); - /* This code must match the TBLOCK_INPROGRESS case below: */ - CommandCounterIncrement(); - } + CommitTransaction(); break; /* @@ -1323,10 +1284,7 @@ AbortCurrentTransaction(void) */ case TBLOCK_DEFAULT: AbortTransaction(); - if (autocommit || suppressChain) - CleanupTransaction(); - else - s->blockState = TBLOCK_ABORT; + CleanupTransaction(); break; /* @@ -1396,9 +1354,7 @@ AbortCurrentTransaction(void) * If we have already started a transaction block, issue an error; also issue * an error if we appear to be running inside a user-defined function (which * could issue more commands and possibly cause a failure after the statement - * completes). In autocommit-off mode, we allow the statement if a block is - * not already started, and force the statement to be autocommitted despite - * the mode. + * completes). * * stmtNode: pointer to parameter block for statement; this is used in * a very klugy way to determine whether we are inside a function. @@ -1428,14 +1384,7 @@ PreventTransactionChain(void *stmtNode, const char *stmtType) /* If we got past IsTransactionBlock test, should be in default state */ if (CurrentTransactionState->blockState != TBLOCK_DEFAULT) elog(ERROR, "PreventTransactionChain: can't prevent chain"); - /* okay to set the flag */ - suppressChain = true; - /* If we're in autocommit-off node, generate a notice */ - if (!autocommit) - { - /* translator: %s represents an SQL statement name */ - elog(NOTICE, "%s will be committed automatically", stmtType); - } + /* all okay */ } /* @@ -1470,12 +1419,6 @@ RequireTransactionChain(void *stmtNode, const char *stmtType) */ if (!MemoryContextContains(QueryContext, stmtNode)) return; - /* - * If we are in autocommit-off mode then it's okay, because this - * statement will itself start a transaction block. - */ - if (!autocommit && !suppressChain) - return; /* translator: %s represents an SQL statement name */ elog(ERROR, "%s may only be used in begin/end transaction blocks", stmtType); @@ -1507,10 +1450,7 @@ BeginTransactionBlock(void) s->blockState = TBLOCK_BEGIN; /* - * do begin processing. NOTE: if you put anything here, check that it - * behaves properly in both autocommit-on and autocommit-off modes. In - * the latter case we will already have done some work in the new - * transaction. + * do begin processing here. Nothing to do at present. */ /* diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y index 1d64ca285cf..100972b3fc1 100644 --- a/src/backend/bootstrap/bootparse.y +++ b/src/backend/bootstrap/bootparse.y @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.55 2002/11/11 22:19:21 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.56 2003/05/14 03:26:00 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -55,7 +55,7 @@ static void do_start() { - StartTransactionCommand(true); + StartTransactionCommand(); elog(DEBUG3, "start transaction"); } @@ -63,7 +63,7 @@ do_start() static void do_end() { - CommitTransactionCommand(true); + CommitTransactionCommand(); elog(DEBUG3, "commit transaction"); if (isatty(0)) { diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index 54b541a0d6c..78383342d00 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.156 2003/05/08 14:49:03 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.157 2003/05/14 03:26:00 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -479,7 +479,7 @@ BootstrapMain(int argc, char *argv[]) SetProcessingMode(BootstrapProcessing); /* clean up processing */ - StartTransactionCommand(true); + StartTransactionCommand(); cleanup(); /* not reached, here to make compiler happy */ @@ -851,7 +851,7 @@ cleanup() } if (boot_reldesc != NULL) closerel(NULL); - CommitTransactionCommand(true); + CommitTransactionCommand(); proc_exit(Warnings); } diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c index 842a36c57bf..b19fdca0691 100644 --- a/src/backend/catalog/namespace.c +++ b/src/backend/catalog/namespace.c @@ -13,7 +13,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/namespace.c,v 1.50 2003/04/24 21:16:42 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/namespace.c,v 1.51 2003/05/14 03:26:01 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1711,11 +1711,11 @@ RemoveTempRelationsCallback(void) { /* Need to ensure we have a usable transaction. */ AbortOutOfAnyTransaction(); - StartTransactionCommand(true); + StartTransactionCommand(); RemoveTempRelations(myTempNamespace); - CommitTransactionCommand(true); + CommitTransactionCommand(); } } diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index 1d9fbf65809..6b7ed481bec 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.93 2003/04/22 00:08:06 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.94 2003/05/14 03:26:01 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -399,9 +399,9 @@ Async_UnlistenOnExit(void) */ AbortOutOfAnyTransaction(); /* Now we can do the unlisten */ - StartTransactionCommand(true); + StartTransactionCommand(); Async_UnlistenAll(); - CommitTransactionCommand(true); + CommitTransactionCommand(); } /* @@ -769,7 +769,7 @@ ProcessIncomingNotify(void) notifyInterruptOccurred = 0; - StartTransactionCommand(true); + StartTransactionCommand(); lRel = heap_openr(ListenerRelationName, AccessExclusiveLock); tdesc = RelationGetDescr(lRel); @@ -823,7 +823,7 @@ ProcessIncomingNotify(void) */ heap_close(lRel, NoLock); - CommitTransactionCommand(true); + CommitTransactionCommand(); /* * Must flush the notify messages to ensure frontend gets them diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index 6c01094c5a9..09ef0ac598e 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.108 2003/05/02 20:54:33 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.109 2003/05/14 03:26:01 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -205,7 +205,7 @@ cluster(ClusterStmt *stmt) rvs = get_tables_to_cluster(cluster_context); /* Commit to get out of starting transaction */ - CommitTransactionCommand(true); + CommitTransactionCommand(); /* Ok, now that we've got them all, cluster them one by one */ foreach (rv, rvs) @@ -213,14 +213,14 @@ cluster(ClusterStmt *stmt) RelToCluster *rvtc = (RelToCluster *) lfirst(rv); /* Start a new transaction for each relation. */ - StartTransactionCommand(true); + StartTransactionCommand(); SetQuerySnapshot(); /* might be needed for functional index */ cluster_rel(rvtc, true); - CommitTransactionCommand(true); + CommitTransactionCommand(); } /* Start a new transaction for the cleanup work. */ - StartTransactionCommand(true); + StartTransactionCommand(); /* Clean up working storage */ MemoryContextDelete(cluster_context); diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index 5232faadc5c..6a371587368 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.98 2003/05/02 20:54:33 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.99 2003/05/14 03:26:01 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -769,17 +769,16 @@ ReindexDatabase(const char *dbname, bool force, bool all) heap_close(relationRelation, AccessShareLock); /* Now reindex each rel in a separate transaction */ - CommitTransactionCommand(true); + CommitTransactionCommand(); for (i = 0; i < relcnt; i++) { - StartTransactionCommand(true); + StartTransactionCommand(); SetQuerySnapshot(); /* might be needed for functional index */ if (reindex_relation(relids[i], force)) elog(NOTICE, "relation %u was reindexed", relids[i]); - CommitTransactionCommand(true); + CommitTransactionCommand(); } - /* Tell xact.c not to chain the upcoming commit */ - StartTransactionCommand(true); + StartTransactionCommand(); MemoryContextDelete(private_context); } diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 9667eabb8bf..19f4010c1a1 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.252 2003/05/02 20:54:33 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.253 2003/05/14 03:26:01 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -275,7 +275,7 @@ vacuum(VacuumStmt *vacstmt) } /* matches the StartTransaction in PostgresMain() */ - CommitTransactionCommand(true); + CommitTransactionCommand(); } /* @@ -303,7 +303,7 @@ vacuum(VacuumStmt *vacstmt) */ if (vacstmt->vacuum) { - StartTransactionCommand(true); + StartTransactionCommand(); SetQuerySnapshot(); /* might be needed for functional index */ } else @@ -312,7 +312,7 @@ vacuum(VacuumStmt *vacstmt) analyze_rel(relid, vacstmt); if (vacstmt->vacuum) - CommitTransactionCommand(true); + CommitTransactionCommand(); else { MemoryContextSwitchTo(old_context); @@ -330,11 +330,9 @@ vacuum(VacuumStmt *vacstmt) /* * This matches the CommitTransaction waiting for us in - * PostgresMain(). We tell xact.c not to chain the upcoming - * commit, so that a VACUUM doesn't start a transaction block, - * even when autocommit is off. + * PostgresMain(). */ - StartTransactionCommand(true); + StartTransactionCommand(); /* * If it was a database-wide VACUUM, print FSM usage statistics @@ -729,7 +727,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) bool result; /* Begin a transaction for vacuuming this relation */ - StartTransactionCommand(true); + StartTransactionCommand(); SetQuerySnapshot(); /* might be needed for functional index */ /* @@ -746,7 +744,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) ObjectIdGetDatum(relid), 0, 0, 0)) { - CommitTransactionCommand(true); + CommitTransactionCommand(); return true; /* okay 'cause no data there */ } @@ -778,7 +776,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) elog(WARNING, "Skipping \"%s\" --- only table or database owner can VACUUM it", RelationGetRelationName(onerel)); relation_close(onerel, lmode); - CommitTransactionCommand(true); + CommitTransactionCommand(); return false; } @@ -791,7 +789,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) elog(WARNING, "Skipping \"%s\" --- can not process indexes, views or special system tables", RelationGetRelationName(onerel)); relation_close(onerel, lmode); - CommitTransactionCommand(true); + CommitTransactionCommand(); return false; } @@ -805,7 +803,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) if (isOtherTempNamespace(RelationGetNamespace(onerel))) { relation_close(onerel, lmode); - CommitTransactionCommand(true); + CommitTransactionCommand(); return true; /* assume no long-lived data in temp tables */ } @@ -843,7 +841,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) /* * Complete the transaction and free all temporary memory used. */ - CommitTransactionCommand(true); + CommitTransactionCommand(); /* * If the relation has a secondary toast rel, vacuum that too while we diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index a37ed5a9b69..f30662d1ea7 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.343 2003/05/12 16:48:17 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.344 2003/05/14 03:26:01 tgl Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -85,8 +85,6 @@ sigjmp_buf Warn_restart; bool Warn_restart_ready = false; bool InError = false; -extern bool autocommit; - /* * Flags for expensive function optimization -- JMH 3/9/92 */ @@ -148,7 +146,7 @@ static int InteractiveBackend(StringInfo inBuf); static int SocketBackend(StringInfo inBuf); static int ReadCommand(StringInfo inBuf); static void start_xact_command(void); -static void finish_xact_command(bool forceCommit); +static void finish_xact_command(void); static void SigHupHandler(SIGNAL_ARGS); static void FloatExceptionHandler(SIGNAL_ARGS); @@ -861,20 +859,15 @@ exec_simple_query(const char *query_string) PortalDrop(portal, false); - - if (IsA(parsetree, TransactionStmt) || - IsA(parsetree, VariableSetStmt) || - IsA(parsetree, VariableShowStmt) || - IsA(parsetree, VariableResetStmt)) + if (IsA(parsetree, TransactionStmt)) { /* - * If this was a transaction control statement or a variable - * set/show/reset statement, commit it. We will start a - * new xact command for the next command (if any). + * If this was a transaction control statement, commit it. + * We will start a new xact command for the next command (if any). */ - finish_xact_command(true); + finish_xact_command(); } - else if (lnext(parsetree_item) == NIL || !autocommit) + else if (lnext(parsetree_item) == NIL) { /* * If this is the last parsetree of the query string, close down @@ -886,7 +879,7 @@ exec_simple_query(const char *query_string) * historical Postgres behavior, we do not force a transaction * boundary between queries appearing in a single query string. */ - finish_xact_command(false); + finish_xact_command(); } else { @@ -907,6 +900,11 @@ exec_simple_query(const char *query_string) EndCommand(completionTag, dest); } /* end loop over parsetrees */ + /* + * Close down transaction statement, if one is open. + */ + finish_xact_command(); + /* * If there were no parsetrees, return EmptyQueryResponse message. */ @@ -915,11 +913,6 @@ exec_simple_query(const char *query_string) QueryContext = NULL; - /* - * Close down transaction statement, if one is open. - */ - finish_xact_command(false); - /* * Finish up monitoring. */ @@ -1531,7 +1524,7 @@ exec_execute_message(const char *portal_name, long max_rows) * If this was a transaction control statement, commit it. We will * start a new xact command for the next command (if any). */ - finish_xact_command(true); + finish_xact_command(); } else { @@ -1657,7 +1650,7 @@ start_xact_command(void) if (!xact_started) { elog(DEBUG2, "StartTransactionCommand"); - StartTransactionCommand(false); + StartTransactionCommand(); /* Set statement timeout running, if any */ if (StatementTimeout > 0) @@ -1668,7 +1661,7 @@ start_xact_command(void) } static void -finish_xact_command(bool forceCommit) +finish_xact_command(void) { if (xact_started) { @@ -1681,7 +1674,7 @@ finish_xact_command(bool forceCommit) /* Now commit the command */ elog(DEBUG2, "CommitTransactionCommand"); - CommitTransactionCommand(forceCommit); + CommitTransactionCommand(); #ifdef SHOW_MEMORY_STATS /* Print mem stats at each commit for leak tracking */ @@ -2532,7 +2525,7 @@ PostgresMain(int argc, char *argv[], const char *username) if (!IsUnderPostmaster) { puts("\nPOSTGRES backend interactive interface "); - puts("$Revision: 1.343 $ $Date: 2003/05/12 16:48:17 $\n"); + puts("$Revision: 1.344 $ $Date: 2003/05/14 03:26:01 $\n"); } /* @@ -2810,7 +2803,7 @@ PostgresMain(int argc, char *argv[], const char *username) } /* commit the function-invocation transaction */ - finish_xact_command(false); + finish_xact_command(); send_rfq = true; break; @@ -2894,7 +2887,7 @@ PostgresMain(int argc, char *argv[], const char *username) case 'S': /* sync */ pq_getmsgend(input_message); - finish_xact_command(false); + finish_xact_command(); send_rfq = true; break; diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 4d76e69ac99..8fda5d185ec 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.120 2003/04/25 19:45:08 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.121 2003/05/14 03:26:02 tgl Exp $ * * *------------------------------------------------------------------------- @@ -334,7 +334,7 @@ InitPostgres(const char *dbname, const char *username) /* start a new transaction here before access to db */ if (!bootstrap) - StartTransactionCommand(true); + StartTransactionCommand(); /* * It's now possible to do real access to the system catalogs. @@ -420,7 +420,7 @@ InitPostgres(const char *dbname, const char *username) /* close the transaction we started above */ if (!bootstrap) - CommitTransactionCommand(true); + CommitTransactionCommand(); } /* diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index a5651ff7f07..7383cd48dff 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut . * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.123 2003/05/06 20:26:27 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.124 2003/05/14 03:26:02 tgl Exp $ * *-------------------------------------------------------------------- */ @@ -69,7 +69,6 @@ extern bool Log_connections; extern int PreAuthDelay; extern int AuthenticationTimeout; extern int CheckPointTimeout; -extern bool autocommit; extern int CommitDelay; extern int CommitSiblings; extern char *preload_libraries_string; @@ -92,6 +91,7 @@ static const char *assign_min_error_statement(const char *newval, bool doit, bool interactive); static const char *assign_msglvl(int *var, const char *newval, bool doit, bool interactive); +static bool assign_phony_autocommit(bool newval, bool doit, bool interactive); /* @@ -134,6 +134,7 @@ int client_min_messages = NOTICE; static char *log_min_error_statement_str; static char *log_min_messages_str; static char *client_min_messages_str; +static bool phony_autocommit; static double phony_random_seed; static char *client_encoding_string; static char *datestyle_string; @@ -526,8 +527,12 @@ static struct config_bool false, NULL, NULL }, { - {"autocommit", PGC_USERSET}, &autocommit, - true, NULL, NULL + /* + * This var doesn't do anything; it's just here so that we won't + * choke on SET AUTOCOMMIT TO ON from 7.3-vintage clients. + */ + {"autocommit", PGC_USERSET, GUC_NO_SHOW_ALL}, &phony_autocommit, + true, assign_phony_autocommit, NULL }, { {"default_transaction_read_only", PGC_USERSET}, &DefaultXactReadOnly, @@ -3429,6 +3434,18 @@ assign_msglvl(int *var, const char *newval, bool doit, bool interactive) return newval; /* OK */ } +static bool +assign_phony_autocommit(bool newval, bool doit, bool interactive) +{ + if (!newval) + { + if (doit && interactive) + elog(ERROR, "SET AUTOCOMMIT TO OFF is no longer supported"); + return false; + } + return true; +} + #include "guc-file.c" diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 6c5ca36e20b..21a956685b5 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -198,7 +198,6 @@ # # Misc # -#autocommit = true #dynamic_library_path = '$libdir' #search_path = '$user,public' # schema names #datestyle = 'iso, us' diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index df8e09c3d28..9afbdfe07f6 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 60771922e5f..a1545938633 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 f3919048f82..f9db6dfdec1 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 199b86d0041..fd6193dd243 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 83ad4cd7656..ea2295cca42 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 35329531040..f35393f96bb 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 084bebbdd51..372ee922aa2 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 ad562c7eb2b..6ce9e8b1678 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 c67aebf9e26..e58952977dc 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 784c7c252da..796930c4159 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 3b9701d6e0a..d62ff24c1c5 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 df82f21c1b6..6bc6359cd73 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 1a0e9114550..f4c07f701e4 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 diff --git a/src/include/access/xact.h b/src/include/access/xact.h index 5eb4f1f7291..aa284df016f 100644 --- a/src/include/access/xact.h +++ b/src/include/access/xact.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: xact.h,v 1.51 2003/05/12 23:08:50 tgl Exp $ + * $Id: xact.h,v 1.52 2003/05/14 03:26:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -119,8 +119,8 @@ extern AbsoluteTime GetCurrentTransactionStartTimeUsec(int *usec); extern bool TransactionIdIsCurrentTransactionId(TransactionId xid); extern bool CommandIdIsCurrentCommandId(CommandId cid); extern void CommandCounterIncrement(void); -extern void StartTransactionCommand(bool preventChain); -extern void CommitTransactionCommand(bool forceCommit); +extern void StartTransactionCommand(void); +extern void CommitTransactionCommand(void); extern void AbortCurrentTransaction(void); extern void BeginTransactionBlock(void); extern void EndTransactionBlock(void); diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out index ed6a17e9d48..06a5bec15e0 100644 --- a/src/test/regress/expected/alter_table.out +++ b/src/test/regress/expected/alter_table.out @@ -996,7 +996,6 @@ ERROR: Relation "test" has no column "........pg.dropped.1........" copy test from stdin; ERROR: Extra data after last expected column CONTEXT: COPY FROM, line 1 -SET autocommit TO 'on'; select * from test; b | c ---+--- diff --git a/src/test/regress/expected/copy2.out b/src/test/regress/expected/copy2.out index 2d69434b5b8..aa85b43b8ce 100644 --- a/src/test/regress/expected/copy2.out +++ b/src/test/regress/expected/copy2.out @@ -46,7 +46,6 @@ CONTEXT: COPY FROM, line 1 COPY x from stdin; ERROR: Extra data after last expected column CONTEXT: COPY FROM, line 1 -SET autocommit TO 'on'; -- various COPY options: delimiters, oids, NULL string COPY x (b, c, d, e) from stdin with oids delimiter ',' null 'x'; -- check results of copy in diff --git a/src/test/regress/expected/domain.out b/src/test/regress/expected/domain.out index 299bae55f8a..53182afa214 100644 --- a/src/test/regress/expected/domain.out +++ b/src/test/regress/expected/domain.out @@ -41,14 +41,13 @@ INSERT INTO basictest values ('88', 'haha', 'short', '123.1212'); -- Truncate COPY basictest (testvarchar) FROM stdin; -- fail ERROR: value too long for type character varying(5) CONTEXT: COPY FROM, line 1 -SET autocommit TO 'on'; COPY basictest (testvarchar) FROM stdin; select * from basictest; testint4 | testtext | testvarchar | testnumeric ----------+----------+-------------+------------- - 88 | haha | short | 123.12 - 88 | haha | short | 123.12 - | | short | + 88 | haha | short | 123.12 + 88 | haha | short | 123.12 + | | short | (3 rows) -- check that domains inherit operations from base types @@ -129,7 +128,6 @@ INSERT INTO nulltest values ('a', 'b', 'c', NULL, 'd'); -- Good COPY nulltest FROM stdin; --fail ERROR: Domain dcheck does not allow NULL values CONTEXT: COPY FROM, line 1 -SET autocommit TO 'on'; -- Last row is bad COPY nulltest FROM stdin; ERROR: CopyFrom: rejected due to CHECK constraint "nulltest_col5" on "nulltest" @@ -185,10 +183,10 @@ COPY defaulttest(col5) FROM stdin; select * from defaulttest; col1 | col2 | col3 | col4 | col5 | col6 | col7 | col8 ------+------+------+------+------+------+------+------- - 3 | 12 | 5 | 1 | 3 | 88 | 8000 | 12.12 - 3 | 12 | 5 | 2 | 3 | 88 | 8000 | 12.12 - 3 | 12 | 5 | 3 | 3 | 88 | 8000 | 12.12 - 3 | 12 | 5 | 4 | 42 | 88 | 8000 | 12.12 + 3 | 12 | 5 | 1 | 3 | 88 | 8000 | 12.12 + 3 | 12 | 5 | 2 | 3 | 88 | 8000 | 12.12 + 3 | 12 | 5 | 3 | 3 | 88 | 8000 | 12.12 + 3 | 12 | 5 | 4 | 42 | 88 | 8000 | 12.12 (4 rows) drop sequence ddef4_seq; @@ -224,7 +222,7 @@ insert into domdeftest default values; select * from domdeftest; col1 ------ - 3 + 3 (1 row) alter domain ddef1 set default '42'; @@ -232,8 +230,8 @@ insert into domdeftest default values; select * from domdeftest; col1 ------ - 3 - 42 + 3 + 42 (2 rows) alter domain ddef1 drop default; @@ -241,9 +239,9 @@ insert into domdeftest default values; select * from domdeftest; col1 ------ - 3 - 42 - + 3 + 42 + (3 rows) drop table domdeftest; @@ -274,8 +272,8 @@ insert into domtab (col1) values (5); select * from domview; col1 ------ - - 5 + + 5 (2 rows) alter domain dom set not null; @@ -285,8 +283,8 @@ alter domain dom drop not null; select * from domview; col1 ------ - - 5 + + 5 (2 rows) alter domain dom add constraint domchkgt6 check(value > 6); @@ -296,8 +294,8 @@ alter domain dom drop constraint domchkgt6 restrict; select * from domview; col1 ------ - - 5 + + 5 (2 rows) -- cleanup diff --git a/src/test/regress/expected/oidjoins.out b/src/test/regress/expected/oidjoins.out index 0c31a5051ce..0bdecf5ed1b 100644 --- a/src/test/regress/expected/oidjoins.out +++ b/src/test/regress/expected/oidjoins.out @@ -105,6 +105,14 @@ WHERE ambulkdelete != 0 AND ------+-------------- (0 rows) +SELECT ctid, amvacuumcleanup +FROM pg_catalog.pg_am fk +WHERE amvacuumcleanup != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.amvacuumcleanup); + ctid | amvacuumcleanup +------+----------------- +(0 rows) + SELECT ctid, amcostestimate FROM pg_catalog.pg_am fk WHERE amcostestimate != 0 AND @@ -225,6 +233,22 @@ WHERE reltoastidxid != 0 AND ------+--------------- (0 rows) +SELECT ctid, connamespace +FROM pg_catalog.pg_constraint fk +WHERE connamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.connamespace); + ctid | connamespace +------+-------------- +(0 rows) + +SELECT ctid, contypid +FROM pg_catalog.pg_constraint fk +WHERE contypid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.contypid); + ctid | contypid +------+---------- +(0 rows) + SELECT ctid, connamespace FROM pg_catalog.pg_conversion fk WHERE connamespace != 0 AND @@ -553,3 +577,11 @@ WHERE typsend != 0 AND ------+--------- (0 rows) +SELECT ctid, typbasetype +FROM pg_catalog.pg_type fk +WHERE typbasetype != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.typbasetype); + ctid | typbasetype +------+------------- +(0 rows) + diff --git a/src/test/regress/expected/privileges.out b/src/test/regress/expected/privileges.out index c9fd902a7aa..1c63dfcc829 100644 --- a/src/test/regress/expected/privileges.out +++ b/src/test/regress/expected/privileges.out @@ -220,7 +220,6 @@ ERROR: atest2: permission denied -- privileges on functions, languages -- switch to superuser \c - -SET autocommit TO 'on'; REVOKE ALL PRIVILEGES ON LANGUAGE sql FROM PUBLIC; GRANT USAGE ON LANGUAGE sql TO regressuser1; -- ok GRANT USAGE ON LANGUAGE c TO PUBLIC; -- fail @@ -271,7 +270,6 @@ SELECT testfunc1(5); -- ok DROP FUNCTION testfunc1(int); -- fail ERROR: testfunc1: must be owner \c - -SET autocommit TO 'on'; DROP FUNCTION testfunc1(int); -- ok -- restore to sanity GRANT ALL PRIVILEGES ON LANGUAGE sql TO PUBLIC; @@ -295,7 +293,6 @@ select has_table_privilege(1,'rule'); ERROR: pg_class_aclcheck: relation 1 not found -- superuser \c - -SET autocommit TO 'on'; select has_table_privilege(current_user,'pg_shadow','select'); has_table_privilege --------------------- @@ -586,7 +583,6 @@ SELECT has_table_privilege('regressuser1', 'atest4', 'SELECT WITH GRANT OPTION') -- clean up \c regression -SET autocommit TO 'on'; DROP FUNCTION testfunc2(int); DROP FUNCTION testfunc4(boolean); DROP VIEW atestv1; diff --git a/src/test/regress/expected/temp.out b/src/test/regress/expected/temp.out index 75d758d36e3..02acf157d5a 100644 --- a/src/test/regress/expected/temp.out +++ b/src/test/regress/expected/temp.out @@ -43,7 +43,6 @@ DROP TABLE temptest; -- test temp table deletion CREATE TEMP TABLE temptest(col int); \c regression -SET autocommit TO 'on'; SELECT * FROM temptest; ERROR: Relation "temptest" does not exist -- Test ON COMMIT DELETE ROWS diff --git a/src/test/regress/pg_regress.sh b/src/test/regress/pg_regress.sh index 63991ad5ec0..037d6f83ec4 100644 --- a/src/test/regress/pg_regress.sh +++ b/src/test/regress/pg_regress.sh @@ -1,5 +1,5 @@ #! /bin/sh -# $Header: /cvsroot/pgsql/src/test/regress/Attic/pg_regress.sh,v 1.30 2003/04/28 04:29:12 tgl Exp $ +# $Header: /cvsroot/pgsql/src/test/regress/Attic/pg_regress.sh,v 1.31 2003/05/14 03:26:03 tgl Exp $ me=`basename $0` : ${TMPDIR=/tmp} @@ -477,7 +477,7 @@ fi # ---------- message "dropping regression test user accounts" -"$bindir/psql" $psql_options -c 'SET autocommit TO on;DROP GROUP regressgroup1; DROP GROUP regressgroup2; DROP USER regressuser1, regressuser2, regressuser3, regressuser4;' $dbname 2>/dev/null +"$bindir/psql" $psql_options -c 'DROP GROUP regressgroup1; DROP GROUP regressgroup2; DROP USER regressuser1, regressuser2, regressuser3, regressuser4;' $dbname 2>/dev/null if [ $? -eq 2 ]; then echo "$me: could not drop user accounts" (exit 2); exit @@ -550,7 +550,6 @@ do $ECHO_N "test $formatted ... $ECHO_C" (cat <