worries about funny characters.
-->
+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
General Operation
-
- AUTOCOMMIT (boolean)
-
- If set to true,
PostgreSQL will
- automatically do a COMMIT> after each successful command
- that is not inside an explicit transaction block (that is, unless a
- BEGIN> with no matching COMMIT> has been
- given).
- If set to false,
PostgreSQL will
- commit only upon receiving an explicit
- COMMIT> command. This mode can also be thought of as
- implicitly issuing BEGIN> whenever a command is
- received that is not already inside a transaction block. The
- default is true, for compatibility with historical
-
PostgreSQL behavior. However, for
- maximum compatibility with the SQL specification, set it to
- false.
-
-
-
- Even with autocommit> set to false, SET>,
- SHOW>, and RESET> do not start new
- transaction blocks. They are run in their own transactions.
- Once another command is issued, a transaction block
- begins and any SET>, SHOW>, or
- RESET> commands are considered to be part of the
- transaction, i.e., they are committed or rolled back depending
- on the completion status of the transaction. To execute a
- SET>, SHOW>, or RESET>
- command at the start of a transaction block, use BEGIN>
- first.
-
-
-
-
- As of
PostgreSQL 7.3, setting
- autocommit> to false is not well-supported.
- This is a new feature and is not yet handled by all client
- libraries and applications. Before making it the default
- setting in your installation, test carefully.
-
-
-
-
-
-
AUSTRALIAN_TIMEZONES (boolean)
*
*
* 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:
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;
/*
* 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)
{
/*
/*
* 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;
/*
*/
case TBLOCK_DEFAULT:
AbortTransaction();
- if (autocommit || suppressChain)
- CleanupTransaction();
- else
- s->blockState = TBLOCK_ABORT;
+ CleanupTransaction();
break;
/*
* 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.
/* 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 */
}
/*
*/
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);
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.
*/
/*
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
static void
do_start()
{
- StartTransactionCommand(true);
+ StartTransactionCommand();
elog(DEBUG3, "start transaction");
}
static void
do_end()
{
- CommitTransactionCommand(true);
+ CommitTransactionCommand();
elog(DEBUG3, "commit transaction");
if (isatty(0))
{
* 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 $
*
*-------------------------------------------------------------------------
*/
SetProcessingMode(BootstrapProcessing);
/* clean up processing */
- StartTransactionCommand(true);
+ StartTransactionCommand();
cleanup();
/* not reached, here to make compiler happy */
}
if (boot_reldesc != NULL)
closerel(NULL);
- CommitTransactionCommand(true);
+ CommitTransactionCommand();
proc_exit(Warnings);
}
* 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 $
*
*-------------------------------------------------------------------------
*/
{
/* Need to ensure we have a usable transaction. */
AbortOutOfAnyTransaction();
- StartTransactionCommand(true);
+ StartTransactionCommand();
RemoveTempRelations(myTempNamespace);
- CommitTransactionCommand(true);
+ CommitTransactionCommand();
}
}
* 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 $
*
*-------------------------------------------------------------------------
*/
*/
AbortOutOfAnyTransaction();
/* Now we can do the unlisten */
- StartTransactionCommand(true);
+ StartTransactionCommand();
Async_UnlistenAll();
- CommitTransactionCommand(true);
+ CommitTransactionCommand();
}
/*
notifyInterruptOccurred = 0;
- StartTransactionCommand(true);
+ StartTransactionCommand();
lRel = heap_openr(ListenerRelationName, AccessExclusiveLock);
tdesc = RelationGetDescr(lRel);
*/
heap_close(lRel, NoLock);
- CommitTransactionCommand(true);
+ CommitTransactionCommand();
/*
* Must flush the notify messages to ensure frontend gets them
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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)
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);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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);
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
}
/* matches the StartTransaction in PostgresMain() */
- CommitTransactionCommand(true);
+ CommitTransactionCommand();
}
/*
*/
if (vacstmt->vacuum)
{
- StartTransactionCommand(true);
+ StartTransactionCommand();
SetQuerySnapshot(); /* might be needed for functional index */
}
else
analyze_rel(relid, vacstmt);
if (vacstmt->vacuum)
- CommitTransactionCommand(true);
+ CommitTransactionCommand();
else
{
MemoryContextSwitchTo(old_context);
/*
* 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
bool result;
/* Begin a transaction for vacuuming this relation */
- StartTransactionCommand(true);
+ StartTransactionCommand();
SetQuerySnapshot(); /* might be needed for functional index */
/*
ObjectIdGetDatum(relid),
0, 0, 0))
{
- CommitTransactionCommand(true);
+ CommitTransactionCommand();
return true; /* okay 'cause no data there */
}
elog(WARNING, "Skipping \"%s\" --- only table or database owner can VACUUM it",
RelationGetRelationName(onerel));
relation_close(onerel, lmode);
- CommitTransactionCommand(true);
+ CommitTransactionCommand();
return false;
}
elog(WARNING, "Skipping \"%s\" --- can not process indexes, views or special system tables",
RelationGetRelationName(onerel));
relation_close(onerel, lmode);
- CommitTransactionCommand(true);
+ CommitTransactionCommand();
return false;
}
if (isOtherTempNamespace(RelationGetNamespace(onerel)))
{
relation_close(onerel, lmode);
- CommitTransactionCommand(true);
+ CommitTransactionCommand();
return true; /* assume no long-lived data in temp tables */
}
/*
* 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
*
*
* 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
bool Warn_restart_ready = false;
bool InError = false;
-extern bool autocommit;
-
/*
* Flags for expensive function optimization -- JMH 3/9/92
*/
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);
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
* 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
{
EndCommand(completionTag, dest);
} /* end loop over parsetrees */
+ /*
+ * Close down transaction statement, if one is open.
+ */
+ finish_xact_command();
+
/*
* If there were no parsetrees, return EmptyQueryResponse message.
*/
QueryContext = NULL;
- /*
- * Close down transaction statement, if one is open.
- */
- finish_xact_command(false);
-
/*
* Finish up monitoring.
*/
* 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 (!xact_started)
{
elog(DEBUG2, "StartTransactionCommand");
- StartTransactionCommand(false);
+ StartTransactionCommand();
/* Set statement timeout running, if any */
if (StatementTimeout > 0)
}
static void
-finish_xact_command(bool forceCommit)
+finish_xact_command(void)
{
if (xact_started)
{
/* Now commit the command */
elog(DEBUG2, "CommitTransactionCommand");
- CommitTransactionCommand(forceCommit);
+ CommitTransactionCommand();
#ifdef SHOW_MEMORY_STATS
/* Print mem stats at each commit for leak tracking */
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");
}
/*
}
/* commit the function-invocation transaction */
- finish_xact_command(false);
+ finish_xact_command();
send_rfq = true;
break;
case 'S': /* sync */
pq_getmsgend(input_message);
- finish_xact_command(false);
+ finish_xact_command();
send_rfq = true;
break;
*
*
* 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 $
*
*
*-------------------------------------------------------------------------
/* 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.
/* close the transaction we started above */
if (!bootstrap)
- CommitTransactionCommand(true);
+ CommitTransactionCommand();
}
/*
* Written by Peter Eisentraut
.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.123 2003/05/06 20:26:27 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.124 2003/05/14 03:26:02 tgl Exp $
*
*--------------------------------------------------------------------
*/
extern int PreAuthDelay;
extern int AuthenticationTimeout;
extern int CheckPointTimeout;
-extern bool autocommit;
extern int CommitDelay;
extern int CommitSiblings;
extern char *preload_libraries_string;
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);
/*
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;
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,
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"
#
# Misc
#
-#autocommit = true
#dynamic_library_path = '$libdir'
#search_path = '$user,public' # schema names
#datestyle = 'iso, us'
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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
dbname ? fmtId(dbname) : "-");
appendPQExpBuffer(qry, " %s\n\n",
fmtId(user));
- appendPQExpBuffer(qry, "SET autocommit TO 'on';\n\n");
ahprintf(AH, qry->data);
* 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 $
*
*-------------------------------------------------------------------------
*/
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)
PQclear(res);
- res = PQexec(conn, "COMMIT;");
- if (!res ||
- PQresultStatus(res) != PGRES_COMMAND_OK)
- die_horribly(AH, modulename, "could not get version from server: %s", PQerrorMessage(conn));
- PQclear(res);
-
AH->public.remoteVersion = remoteversion;
if (myversion != remoteversion
/* check for version mismatch */
_check_database_version(AH, 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;
/* 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;
* 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 $
*
*-------------------------------------------------------------------------
*/
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);
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)
{
}
PQclear(res);
- if (server_version >= 70300)
- {
- PGresult *res;
-
- res = executeQuery(conn, "SET autocommit TO 'on';SELECT 1;");
- PQclear(res);
- }
-
return conn;
}
*
* 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"
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);
*
* 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 $
*/
/*----------------------------------------------------------------------
* backend/utils/misc/guc.c.
*/
"australian_timezones",
- "autocommit",
"client_encoding",
"client_min_messages",
"commit_delay",
#
#
# 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 $
#
#-------------------------------------------------------------------------
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
* 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 $
*
*-------------------------------------------------------------------------
*/
initPQExpBuffer(&sql);
- appendPQExpBuffer(&sql, "SET autocommit TO on;\nCREATE DATABASE %s",
+ appendPQExpBuffer(&sql, "CREATE DATABASE %s",
fmtId(dbname));
if (owner)
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");
* 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 $
*
*-------------------------------------------------------------------------
*/
/*
* Create the call handler and the language
*/
- printfPQExpBuffer(&sql, "SET autocommit TO on;\n");
+ resetPQExpBuffer(&sql);
if (!handlerexists)
appendPQExpBuffer(&sql,
* 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 $
*
*-------------------------------------------------------------------------
*/
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)
* 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 $
*
*-------------------------------------------------------------------------
*/
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);
* 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 $
*
*-------------------------------------------------------------------------
*/
/*
* 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)
* 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 $
*
*-------------------------------------------------------------------------
*/
}
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);
#
#
# 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 $
#
#-------------------------------------------------------------------------
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
* 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 $
*
*-------------------------------------------------------------------------
*/
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);
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
---+---
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
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
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"
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;
select * from domdeftest;
col1
------
- 3
+ 3
(1 row)
alter domain ddef1 set default '42';
select * from domdeftest;
col1
------
- 3
- 42
+ 3
+ 42
(2 rows)
alter domain ddef1 drop default;
select * from domdeftest;
col1
------
- 3
- 42
-
+ 3
+ 42
+
(3 rows)
drop table domdeftest;
select * from domview;
col1
------
-
- 5
+
+ 5
(2 rows)
alter domain dom set not null;
select * from domview;
col1
------
-
- 5
+
+ 5
(2 rows)
alter domain dom add constraint domchkgt6 check(value > 6);
select * from domview;
col1
------
-
- 5
+
+ 5
(2 rows)
-- cleanup
------+--------------
(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
------+---------------
(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
------+---------
(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)
+
-- 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
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;
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
---------------------
-- clean up
\c regression
-SET autocommit TO 'on';
DROP FUNCTION testfunc2(int);
DROP FUNCTION testfunc4(boolean);
DROP VIEW atestv1;
-- 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
#! /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}
# ----------
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
$ECHO_N "test $formatted ... $ECHO_C"
(cat <
-SET autocommit TO 'on';
\\set ECHO all
EOF
cat "$inputdir/sql/$1.sql") | \
for name do
(
(cat <
-SET autocommit TO 'on';
\\set ECHO all
EOF
cat "$inputdir/sql/$name.sql") | \
copy test from stdin;
10 11 12
\.
-SET autocommit TO 'on';
select * from test;
copy test from stdin;
21 22
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
notsoshorttext
\.
-SET autocommit TO 'on';
-
COPY basictest (testvarchar) FROM stdin;
short
\.
a b \N d \N
\.
-SET autocommit TO 'on';
-
-- Last row is bad
COPY nulltest FROM stdin;
a b c \N c
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
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);
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);
-- switch to superuser
\c -
-SET autocommit TO 'on';
REVOKE ALL PRIVILEGES ON LANGUAGE sql FROM PUBLIC;
GRANT USAGE ON LANGUAGE sql TO regressuser1; -- ok
DROP FUNCTION testfunc1(int); -- fail
\c -
-SET autocommit TO 'on';
DROP FUNCTION testfunc1(int); -- ok
-- restore to sanity
-- superuser
\c -
-SET autocommit TO 'on';
select has_table_privilege(current_user,'pg_shadow','select');
select has_table_privilege(current_user,'pg_shadow','insert');
-- clean up
\c regression
-SET autocommit TO 'on';
DROP FUNCTION testfunc2(int);
DROP FUNCTION testfunc4(boolean);
CREATE TEMP TABLE temptest(col int);
\c regression
-SET autocommit TO 'on';
SELECT * FROM temptest;