diff options
Diffstat (limited to 'src')
39 files changed, 188 insertions, 269 deletions
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 { @@ -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 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 <peter_e@gmx.net>. * * 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 @@ -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 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 <<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 c97b72cabef..f28b4f246c5 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 b036cb1b7f9..72c52dba113 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 00a38f449cd..32295ff1866 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 a9df8f666a1..5e8323bc11b 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 d7076d2575c..d3e9b543035 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 5ebd13c83cc..397d00bfd94 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; |