diff options
author | Tom Lane | 2003-05-14 03:26:03 +0000 |
---|---|---|
committer | Tom Lane | 2003-05-14 03:26:03 +0000 |
commit | d68047937dd873539ae10f411dd3365c2bf1c972 (patch) | |
tree | f514eb61ee901317159d15d3696e74d5dea6d603 | |
parent | 64173bb9be426284b81ac79d15284abb54c1f1b9 (diff) |
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.
99 files changed, 233 insertions, 492 deletions
diff --git a/contrib/adddepend/adddepend b/contrib/adddepend/adddepend index e007d448fd..6edede322d 100755 --- a/contrib/adddepend/adddepend +++ b/contrib/adddepend/adddepend @@ -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 cf3331a387..4108a63eaf 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 4f0b1291df..70db5a860d 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 3cd35992e4..497740062d 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 dea597a7ba..cf6411b014 100644 --- a/contrib/chkpass/chkpass.sql.in +++ b/contrib/chkpass/chkpass.sql.in @@ -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 e79eb5263c..6afcce5aeb 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 3a1e670d66..aeda8314d7 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 5f67383725..b57b5c7688 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 ed3a87cfa0..945f1bd16a 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 4d534e50c1..f041e0a770 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 de07c3ae00..97150d3aa7 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 7de5c12dd4..15ea679915 100755 --- a/contrib/dbmirror/DBMirror.pl +++ b/contrib/dbmirror/DBMirror.pl @@ -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 7f54fa2967..4227ca5f39 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 1c198db925..509b7ba112 100755 --- a/contrib/dbmirror/clean_pending.pl +++ b/contrib/dbmirror/clean_pending.pl @@ -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 6ee9a87b4f..6520c6eb41 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 963c3b11b0..e1aadef9c7 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 95a63d9c47..35f2228108 100644 --- a/contrib/findoidjoins/findoidjoins.c +++ b/contrib/findoidjoins/findoidjoins.c @@ -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 60c7d97c6b..17f000149b 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 d109aa9a10..93eff0f633 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 5a330546ab..a06bab860f 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 3dc2888f40..c548b8ba9f 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 8e929a6047..31279c5b33 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 c75916507f..21786e51e7 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 b29cf0b0ee..b602df33d8 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 681e8063ad..22e3e8b95a 100644 --- a/contrib/isbn_issn/isbn_issn.sql.in +++ b/contrib/isbn_issn/isbn_issn.sql.in @@ -7,8 +7,6 @@ -- 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: -- diff --git a/contrib/lo/lo.sql.in b/contrib/lo/lo.sql.in index 84f097f592..6289f32760 100644 --- a/contrib/lo/lo.sql.in +++ b/contrib/lo/lo.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 FUNCTION lo_in(cstring) RETURNS lo AS 'MODULE_PATHNAME' diff --git a/contrib/lo/lo_drop.sql b/contrib/lo/lo_drop.sql index d7f34f8bed..c6c491b2c1 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 01246444f8..d856f0dbab 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 2f267b9828..7d8bdc3524 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 ddf3274813..b7e0a8b367 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 47213779b4..32a047447f 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 d6cb526a1a..a5c18d761f 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 b47313b6b6..5c7a38c449 100644 --- a/contrib/pg_dumplo/main.c +++ b/contrib/pg_dumplo/main.c @@ -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 4b4d1f8bbd..35d2d44802 100644 --- a/contrib/pgbench/pgbench.c +++ b/contrib/pgbench/pgbench.c @@ -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 0f3cbe537a..31e1773a41 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 5489c93812..c32c00ba3f 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 f0dd79930a..b1cea9201a 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 e42ec9c63a..e73fd2671c 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 f7ad2748bc..c721694f39 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 bf075593c9..5c0c1fceaa 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 42e2deec4b..a1e7e0cf48 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 cec50b6189..75889b3786 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 c8c6766579..3d096592d2 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 e89c37e6d5..9bdaa9aefe 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 322de9521e..14b135e258 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 b297a23ec2..f20e9fedf6 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 3055d9cab0..3271d28064 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 91f28dd47d..6b92d45f7c 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 4577fa02e8..899b720eb6 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 1826fcf249..62689c5543 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 5524b3dd35..6aee9ff87d 100644 --- a/contrib/vacuumlo/vacuumlo.c +++ b/contrib/vacuumlo/vacuumlo.c @@ -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 0814baa593..514643b936 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 0814baa593..514643b936 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 bc0dd0f5d1..6f2fa914ff 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -866,8 +866,13 @@ returned by the server. maintain the <structname>PGresult</structname> abstraction. Use the accessor functions below to get at the contents of <structname>PGresult</structname>. Avoid directly referencing the fields of the <structname>PGresult</structname> structure because they are subject to change in the future. -If <quote>autocommit</quote> is on, multiple queries sent in a single -function call are processed in a single transaction. +</para> + +<para> +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. </para> <variablelist> diff --git a/doc/src/sgml/ref/begin.sgml b/doc/src/sgml/ref/begin.sgml index 52d8343b6e..35b4857b80 100644 --- a/doc/src/sgml/ref/begin.sgml +++ b/doc/src/sgml/ref/begin.sgml @@ -98,12 +98,6 @@ BEGIN [ WORK | TRANSACTION ] <xref linkend="SQL-ROLLBACK" endterm="SQL-ROLLBACK-TITLE"> to terminate a transaction. </para> - - <para> - If you turn the configuration parameter <varname>autocommit</> off, - then <command>BEGIN</> is not required: any SQL command - automatically starts a transaction. - </para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index e5bd58354c..9d644f156a 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -88,9 +88,11 @@ PostgreSQL documentation select * from foo;" | psql</literal>. </para> <para> - If <quote>autocommit</quote> 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. </para> </listitem> </varlistentry> diff --git a/doc/src/sgml/ref/set.sgml b/doc/src/sgml/ref/set.sgml index 1e0c5a04d2..5692383c7b 100644 --- a/doc/src/sgml/ref/set.sgml +++ b/doc/src/sgml/ref/set.sgml @@ -55,12 +55,6 @@ SET [ SESSION | LOCAL ] TIME ZONE { <replaceable class="PARAMETER">timezone</rep seen until the end of the transaction, but afterwards (if the transaction is committed) the <command>SET</command> value will take effect. </para> - - <para> - Even with <varname>autocommit</> set to <literal>off</>, <command>SET</> - does not start a new transaction block. See the - <varname>autocommit</> section in <xref linkend="runtime-config"> for details. - </para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/show.sgml b/doc/src/sgml/ref/show.sgml index b898d649d8..8dd9770cf3 100644 --- a/doc/src/sgml/ref/show.sgml +++ b/doc/src/sgml/ref/show.sgml @@ -37,12 +37,6 @@ SHOW ALL <command>postmaster</command>. See <xref linkend="runtime-config"> for details. </para> - - <para> - Even with <varname>autocommit</> set to <literal>off</>, <command>SHOW</> - does not start a new transaction block. See the - <varname>autocommit</> section in <xref linkend="runtime-config"> for details. - </para> </refsect1> <refsect1> diff --git a/doc/src/sgml/release.sgml b/doc/src/sgml/release.sgml index b7596f2eed..f3b9190eed 100644 --- a/doc/src/sgml/release.sgml +++ b/doc/src/sgml/release.sgml @@ -24,6 +24,8 @@ CDATA means the content is "SGML-free", so you can write without worries about funny characters. --> <literallayout><![CDATA[ +New frontend/backend protocol supports many long-requested features +SET AUTOCOMMIT TO OFF is no longer supported Reimplementation of NUMERIC datatype for more speed New regular expression package, many more regexp features (most of Perl5) Can now do EXPLAIN ... EXECUTE to see plan used for a prepared query diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index 660958a4c5..24ac3a9451 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -1290,56 +1290,6 @@ SET ENABLE_SEQSCAN TO OFF; <variablelist> <varlistentry> - <term><varname>AUTOCOMMIT</varname> (<type>boolean</type>)</term> - <indexterm><primary>autocommit</></> - <listitem> - <para> - If set to true, <productname>PostgreSQL</productname> will - automatically do a <command>COMMIT</> after each successful command - that is not inside an explicit transaction block (that is, unless a - <command>BEGIN</> with no matching <command>COMMIT</> has been - given). - If set to false, <productname>PostgreSQL</productname> will - commit only upon receiving an explicit - <command>COMMIT</> command. This mode can also be thought of as - implicitly issuing <command>BEGIN</> whenever a command is - received that is not already inside a transaction block. The - default is true, for compatibility with historical - <productname>PostgreSQL</productname> behavior. However, for - maximum compatibility with the SQL specification, set it to - false. - </para> - - <note> - <para> - Even with <varname>autocommit</> set to false, <command>SET</>, - <command>SHOW</>, and <command>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 <command>SET</>, <command>SHOW</>, or - <command>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 - <command>SET</>, <command>SHOW</>, or <command>RESET</> - command at the start of a transaction block, use <command>BEGIN</> - first. - </para> - </note> - - <note> - <para> - As of <productname>PostgreSQL</productname> 7.3, setting - <varname>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. - </para> - </note> - - </listitem> - </varlistentry> - - <varlistentry> <term><varname>AUSTRALIAN_TIMEZONES</varname> (<type>boolean</type>)</term> <indexterm><primary>Australian time zones</></> <listitem> diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index d3789c8cf9..8175079ec7 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -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 dd23c464e5..f84e5db7f3 100644 --- a/src/backend/bootstrap/bootparse.y +++ b/src/backend/bootstrap/bootparse.y @@ -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 e56a8f0519..36a7078850 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -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 020cded537..fbfb95d067 100644 --- a/src/backend/catalog/namespace.c +++ b/src/backend/catalog/namespace.c @@ -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 33a829b209..3d0749b1ae 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -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 6489b4247f..10ddc9fcc2 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -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 e8722ab1e3..ab22bc6baa 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -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 75c2595c84..1c3e603db6 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -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 558d2eb66d..2adfd246df 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -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 { @@ -908,6 +901,11 @@ exec_simple_query(const char *query_string) } /* end loop over parsetrees */ /* + * Close down transaction statement, if one is open. + */ + finish_xact_command(); + + /* * If there were no parsetrees, return EmptyQueryResponse message. */ if (!parsetree_list) @@ -916,11 +914,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. */ if (save_log_duration) @@ -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 0c7f29dc42..cd4049c02d 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -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 ecaf13650a..c001eb656f 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -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 6c5ca36e20..21a956685b 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 aac39c1735..355741b399 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -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 134e46731e..a354a8c748 100644 --- a/src/bin/pg_dump/pg_backup_db.c +++ b/src/bin/pg_dump/pg_backup_db.c @@ -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 934d312b52..2ba8cc2920 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -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 5a09a49fb5..c39289a7de 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -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 94ddf2df9c..69abd9ab6a 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -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 a63dc61d4c..b91b02fe99 100644 --- a/src/bin/scripts/clusterdb +++ b/src/bin/scripts/clusterdb @@ -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 01864ef866..baa75b16df 100644 --- a/src/bin/scripts/createdb.c +++ b/src/bin/scripts/createdb.c @@ -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 8f692f7d11..24a5d8b677 100644 --- a/src/bin/scripts/createlang.c +++ b/src/bin/scripts/createlang.c @@ -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 4a10fea7b7..a1637a5109 100644 --- a/src/bin/scripts/createuser.c +++ b/src/bin/scripts/createuser.c @@ -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 40155f2232..3e874abee9 100644 --- a/src/bin/scripts/dropdb.c +++ b/src/bin/scripts/dropdb.c @@ -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 de90f0cdad..5d0036cadf 100644 --- a/src/bin/scripts/droplang.c +++ b/src/bin/scripts/droplang.c @@ -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 7e96f1d461..7c492e33ca 100644 --- a/src/bin/scripts/dropuser.c +++ b/src/bin/scripts/dropuser.c @@ -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 896a5153e2..c1133624e2 100644 --- a/src/bin/scripts/vacuumdb +++ b/src/bin/scripts/vacuumdb @@ -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 0f06a8b482..d4042a2932 100644 --- a/src/include/access/xact.h +++ b/src/include/access/xact.h @@ -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 ed6a17e9d4..06a5bec15e 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 2d69434b5b..aa85b43b8c 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 299bae55f8..53182afa21 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 0c31a5051c..0bdecf5ed1 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 @@ -226,6 +234,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 NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.connamespace); @@ -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 c9fd902a7a..1c63dfcc82 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 75d758d36e..02acf157d5 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 a2fff57748..18b2516230 100644 --- a/src/test/regress/pg_regress.sh +++ b/src/test/regress/pg_regress.sh @@ -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 <<EOF -SET autocommit TO 'on'; \\set ECHO all EOF cat "$inputdir/sql/$1.sql") | \ @@ -561,7 +560,6 @@ EOF for name do ( (cat <<EOF -SET autocommit TO 'on'; \\set ECHO all EOF cat "$inputdir/sql/$name.sql") | \ diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql index c97b72cabe..f28b4f246c 100644 --- a/src/test/regress/sql/alter_table.sql +++ b/src/test/regress/sql/alter_table.sql @@ -717,7 +717,6 @@ copy test("........pg.dropped.1........") to stdout; copy test from stdin; 10 11 12 \. -SET autocommit TO 'on'; select * from test; copy test from stdin; 21 22 diff --git a/src/test/regress/sql/copy2.sql b/src/test/regress/sql/copy2.sql index b036cb1b7f..72c52dba11 100644 --- a/src/test/regress/sql/copy2.sql +++ b/src/test/regress/sql/copy2.sql @@ -71,7 +71,6 @@ COPY x from stdin; 2002 232 40 50 60 70 80 \. -SET autocommit TO 'on'; -- various COPY options: delimiters, oids, NULL string COPY x (b, c, d, e) from stdin with oids delimiter ',' null 'x'; 500000,x,45,80,90 diff --git a/src/test/regress/sql/domain.sql b/src/test/regress/sql/domain.sql index 00a38f449c..32295ff186 100644 --- a/src/test/regress/sql/domain.sql +++ b/src/test/regress/sql/domain.sql @@ -41,8 +41,6 @@ COPY basictest (testvarchar) FROM stdin; -- fail notsoshorttext \. -SET autocommit TO 'on'; - COPY basictest (testvarchar) FROM stdin; short \. @@ -106,8 +104,6 @@ COPY nulltest FROM stdin; --fail a b \N d \N \. -SET autocommit TO 'on'; - -- Last row is bad COPY nulltest FROM stdin; a b c \N c diff --git a/src/test/regress/sql/oidjoins.sql b/src/test/regress/sql/oidjoins.sql index a9df8f666a..5e8323bc11 100644 --- a/src/test/regress/sql/oidjoins.sql +++ b/src/test/regress/sql/oidjoins.sql @@ -53,6 +53,10 @@ SELECT ctid, ambulkdelete FROM pg_catalog.pg_am fk WHERE ambulkdelete != 0 AND NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.ambulkdelete); +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); SELECT ctid, amcostestimate FROM pg_catalog.pg_am fk WHERE amcostestimate != 0 AND @@ -114,6 +118,14 @@ FROM pg_catalog.pg_class fk WHERE reltoastidxid != 0 AND NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.reltoastidxid); 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); +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); +SELECT ctid, connamespace FROM pg_catalog.pg_conversion fk WHERE connamespace != 0 AND NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.connamespace); @@ -277,3 +289,7 @@ SELECT ctid, typsend FROM pg_catalog.pg_type fk WHERE typsend != 0 AND NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.typsend); +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); diff --git a/src/test/regress/sql/privileges.sql b/src/test/regress/sql/privileges.sql index d7076d2575..d3e9b54303 100644 --- a/src/test/regress/sql/privileges.sql +++ b/src/test/regress/sql/privileges.sql @@ -147,7 +147,6 @@ SELECT * FROM atestv2; -- fail (even though regressuser2 can access underlying a -- switch to superuser \c - -SET autocommit TO 'on'; REVOKE ALL PRIVILEGES ON LANGUAGE sql FROM PUBLIC; GRANT USAGE ON LANGUAGE sql TO regressuser1; -- ok @@ -184,7 +183,6 @@ SELECT testfunc1(5); -- ok DROP FUNCTION testfunc1(int); -- fail \c - -SET autocommit TO 'on'; DROP FUNCTION testfunc1(int); -- ok -- restore to sanity @@ -203,7 +201,6 @@ select has_table_privilege(1,'rule'); -- superuser \c - -SET autocommit TO 'on'; select has_table_privilege(current_user,'pg_shadow','select'); select has_table_privilege(current_user,'pg_shadow','insert'); @@ -323,7 +320,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); diff --git a/src/test/regress/sql/temp.sql b/src/test/regress/sql/temp.sql index 5ebd13c83c..397d00bfd9 100644 --- a/src/test/regress/sql/temp.sql +++ b/src/test/regress/sql/temp.sql @@ -48,7 +48,6 @@ DROP TABLE temptest; CREATE TEMP TABLE temptest(col int); \c regression -SET autocommit TO 'on'; SELECT * FROM temptest; |