Make SET SESSION CHARACTERISTICS compliant with SQL 99. Remove redundant,
authorPeter Eisentraut
Fri, 24 Nov 2000 20:16:40 +0000 (20:16 +0000)
committerPeter Eisentraut
Fri, 24 Nov 2000 20:16:40 +0000 (20:16 +0000)
non-standard clauses.  Allow CHARACTERISTICS as unquoted identifier.
Merge related reference pages.

doc/src/sgml/ref/allfiles.sgml
doc/src/sgml/ref/set_session.sgml [deleted file]
doc/src/sgml/ref/set_transaction.sgml
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/parser/analyze.c
src/backend/parser/gram.y
src/include/nodes/nodes.h
src/include/nodes/parsenodes.h

index 3463b02777c2b50aacd4e20c294085d86644fb01..6c9bbc5248ddcfd66bc553791224b100e8e77e4b 100644 (file)
@@ -1,5 +1,5 @@
 
@@ -95,7 +95,6 @@ Complete list of usable sgml source files in this directory.
 
 
 
-
 
 
 
diff --git a/doc/src/sgml/ref/set_session.sgml b/doc/src/sgml/ref/set_session.sgml
deleted file mode 100644 (file)
index b542d66..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-  SET
-  SQL - Language Statements
-  SET SESSION CHARACTERISTICS
-  Set per-session run-time parameters
-  
-SET SESSION CHARACTERISTICS TRANSACTION ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE }
-SET SESSION CHARACTERISTICS TIME ZONE { 'timezone' | LOCAL | DEFAULT }
-  
-
-  Description
-  
-   SET SESSION CHARACTERISTICS changes the run-time
-   environment for the entire SQL
-   session. Currently, transaction isolation level and time zone can
-   be specified by this command.
-  
-
-  
-   Use  to show the
-   current setting of a parameters.
-  
-
-  
-   Refer to 
-   and to  for more
-   information on allowed parameters.
-  
-
-  Examples
-
-  
-   Set the timezone for Berkeley, California, using double quotes to
-   preserve the uppercase attributes of the time zone specifier (note
-   that the date/time format is ISO here):
-
- 
-SET SESSION CHARACTERISTICS TIME ZONE "PST8PDT";
-SELECT CURRENT_TIMESTAMP AS today;
-   
-         today
-------------------------
- 1998-07-14 07:41:21-07
-
-  
-
-  Compatibility
-
-  
-   SQL99
-
-   
-    SET SESSION is defined in
-    SQL99.
-   
-  
-
-
-
index a5ca5fac1ff3cb95f264d2e84f3d76f24d6a1409..488ee6ac31c1b08cd8083b11d5fdc58e3631a9a9 100644 (file)
@@ -1,19 +1,23 @@
-
+
 
+  2000-11-24
+
  
   SET TRANSACTION
   SQL - Language Statements
  
+
  
   SET TRANSACTION
   Set the characteristics of the current SQL-transaction
  
+
  
-  
-   2000-06-01
-  
   
 SET TRANSACTION ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE }
+SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE }
   
  
 
@@ -21,13 +25,17 @@ SET TRANSACTION ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE }
   Description
 
   
-   The SET TRANSACTION command sets the
-   characteristics for the current SQL-transaction. It has no effect
-   on any subsequent transactions. This command cannot be used after
-   the first DML statement (SELECT,
-   INSERTDELETE,
-   UPDATEFETCH,
-   COPY) of a transaction has been executed.
+   This command sets the transaction isolation level.  The
+   SET TRANSACTION command sets the characteristics
+   for the current SQL-transaction. It has no effect on any subsequent
+   transactions.  This command cannot be used after the first DML
+   statement (SELECTINSERT,
+   DELETEUPDATE,
+   FETCHCOPY) of a transaction
+   has been executed.  SET SESSION CHARACTERISTICS
+   sets the default transaction isolation level for each transaction
+   for a session.  SET TRANSACTION can override it
+   for an individual transaction.
   
 
   
@@ -83,7 +91,7 @@ SET TRANSACTION ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE }
 
    
     In SQL there are two other transaction
-    characteristics that can be set with this command: whether the
+    characteristics that can be set with these commands: whether the
     transaction is read-only and the size of the diagnostics area.
     Neither of these concepts are supported in Postgres.
    
index 9c342b5dc1e4c9e9f7ce422726f5a7cdda6b44e3..1e03e044182879e1d2b6f1cf5aa75b0bb220b73e 100644 (file)
@@ -15,7 +15,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.132 2000/11/14 18:37:42 tgl Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.133 2000/11/24 20:16:39 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -2513,16 +2513,6 @@ _copyReindexStmt(ReindexStmt *from)
    return newnode;
 }
 
-static SetSessionStmt *
-_copySetSessionStmt(SetSessionStmt *from)
-{
-   SetSessionStmt   *newnode = makeNode(SetSessionStmt);
-
-   Node_Copy(from, newnode, args);
-
-   return newnode;
-}
-
 
 /* ****************************************************************
  *                 pg_list.h copy functions
@@ -2922,9 +2912,6 @@ copyObject(void *from)
        case T_ReindexStmt:
            retval = _copyReindexStmt(from);
            break;
-       case T_SetSessionStmt:
-           retval = _copySetSessionStmt(from);
-           break;
        case T_CheckPointStmt:
            retval = (void*)makeNode(CheckPointStmt);
            break;
index aac0902a028b1426fbc54129dabcc7ca39419525..51dbd24976ccec6aacb74c19d43a25099fdc9890 100644 (file)
@@ -20,7 +20,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.82 2000/11/14 18:37:42 tgl Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.83 2000/11/24 20:16:39 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1363,15 +1363,6 @@ _equalReindexStmt(ReindexStmt *a, ReindexStmt *b)
    return true;
 }
 
-static bool
-_equalSetSessionStmt(SetSessionStmt *a, SetSessionStmt *b)
-{
-   if (!equal(a->args, b->args))
-       return false;
-
-   return true;
-}
-
 static bool
 _equalAExpr(A_Expr *a, A_Expr *b)
 {
@@ -2037,9 +2028,6 @@ equal(void *a, void *b)
        case T_ReindexStmt:
            retval = _equalReindexStmt(a, b);
            break;
-       case T_SetSessionStmt:
-           retval = _equalSetSessionStmt(a, b);
-           break;
        case T_CheckPointStmt:
            retval = true;
            break;
index 5c5942e4b7c10cd5f7b46a2970c8bd1eb2d7bb1b..3b1d5b397622aade20ce2f4252c5ded3dd4800b5 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: analyze.c,v 1.167 2000/11/18 16:17:20 petere Exp $
+ * $Id: analyze.c,v 1.168 2000/11/24 20:16:39 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -208,38 +208,6 @@ transformStmt(ParseState *pstate, Node *parseTree)
            result = transformAlterTableStmt(pstate, (AlterTableStmt *) parseTree);
            break;
 
-       case T_SetSessionStmt:
-           {
-               List *l;
-               /* Session is a list of SetVariable nodes
-                * so just run through the list.
-                */
-               SetSessionStmt *stmt = (SetSessionStmt *) parseTree;
-
-               l = stmt->args;
-               /* First check for duplicate keywords (disallowed by SQL99) */
-               while (l != NULL)
-               {
-                   VariableSetStmt *v = (VariableSetStmt *) lfirst(l);
-                   List *ll = lnext(l);
-                   while (ll != NULL)
-                   {
-                       VariableSetStmt *vv = (VariableSetStmt *) lfirst(ll);
-                       if (strcmp(v->name, vv->name) == 0)
-                           elog(ERROR, "SET SESSION CHARACTERISTICS duplicated entry not allowed");
-                       ll = lnext(ll);
-                   }
-                   l = lnext(l);
-               }
-
-               l = stmt->args;
-               result = transformStmt(pstate, lfirst(l));
-               l = lnext(l);
-               if (l != NULL)
-                   extras_after = lappend(extras_after, lfirst(l));
-           }
-           break;
-
            /*------------------------
             *  Optimizable statements
             *------------------------
index 3c4a2e00c9c2c9ccf516ba978450eaf9ff2bae23..b910f80fe4a48a0d2d13d36f4f76123d4fe9e531 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.209 2000/11/14 18:37:49 tgl Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.210 2000/11/24 20:16:39 petere Exp $
  *
  * HISTORY
  *   AUTHOR            DATE            MAJOR EVENT
@@ -134,15 +134,12 @@ static void doNegateFloat(Value *v);
        NotifyStmt, OptimizableStmt, ProcedureStmt, ReindexStmt,
        RemoveAggrStmt, RemoveFuncStmt, RemoveOperStmt,
        RenameStmt, RevokeStmt, RuleActionStmt, RuleActionStmtOrEmpty,
-       RuleStmt, SelectStmt, SetSessionStmt, TransactionStmt, TruncateStmt,
+       RuleStmt, SelectStmt, TransactionStmt, TruncateStmt,
        UnlistenStmt, UpdateStmt, VacuumStmt, VariableResetStmt,
        VariableSetStmt, VariableShowStmt, ViewStmt, CheckPointStmt
 
 %type    select_no_parens, select_clause, simple_select
 
-%type    SessionList
-%type    SessionClause
-
 %type     alter_column_action
 %type     drop_behavior
 
@@ -459,7 +456,6 @@ stmt :  AlterSchemaStmt
        | RevokeStmt
        | OptimizableStmt
        | RuleStmt
-       | SetSessionStmt
        | TransactionStmt
        | ViewStmt
        | LoadStmt
@@ -706,55 +702,6 @@ DropSchemaStmt:  DROP SCHEMA UserId
                }
 
 
-/*****************************************************************************
- *
- * Manipulate a postgresql session
- *
- *
- *****************************************************************************/
-
-SetSessionStmt:  SET SESSION CHARACTERISTICS AS SessionList
-               {
-                   SetSessionStmt *n = makeNode(SetSessionStmt);
-                   n->args = $5;
-                   $$ = (Node*)n;
-               }
-       ;
-
-SessionList:  SessionList ',' SessionClause
-               {
-                   $$ = lappend($1, $3);
-               }
-       | SessionClause
-               {
-                   $$ = makeList1($1);
-               }
-       ;
-
-SessionClause:  TRANSACTION COMMIT opt_boolean
-               {
-                   VariableSetStmt *n = makeNode(VariableSetStmt);
-                   n->name  = "autocommit";
-                   n->value = $3;
-                   $$ = (Node *) n;
-               }
-       | TIME ZONE zone_value
-               {
-                   VariableSetStmt *n = makeNode(VariableSetStmt);
-                   n->name  = "timezone";
-                   n->value = $3;
-                   $$ = (Node *) n;
-               }
-       | TRANSACTION ISOLATION LEVEL opt_level
-               {
-                   VariableSetStmt *n = makeNode(VariableSetStmt);
-                   n->name  = "DefaultXactIsoLevel";
-                   n->value = $4;
-                   $$ = (Node *) n;
-               }
-           ;
-
-
 /*****************************************************************************
  *
  * Set PG internal variable
@@ -792,6 +739,13 @@ VariableSetStmt:  SET ColId TO var_value
                    n->value = $5;
                    $$ = (Node *) n;
                }
+        | SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL opt_level
+               {
+                   VariableSetStmt *n = makeNode(VariableSetStmt);
+                   n->name  = "DefaultXactIsoLevel";
+                   n->value = $8;
+                   $$ = (Node *) n;
+               }
        | SET NAMES opt_encoding
                {
                    VariableSetStmt *n = makeNode(VariableSetStmt);
@@ -5444,6 +5398,7 @@ TokenId:  ABSOLUTE                        { $$ = "absolute"; }
        | CACHE                         { $$ = "cache"; }
        | CASCADE                       { $$ = "cascade"; }
        | CHAIN                         { $$ = "chain"; }
+       | CHARACTERISTICS               { $$ = "characteristics"; }
        | CHECKPOINT                    { $$ = "checkpoint"; }
        | CLOSE                         { $$ = "close"; }
        | COMMENT                       { $$ = "comment"; }
index 6b64961525a7fd1fa6fba05295d5ff62e18d9a7e..0d3d3af8a1cc20dfc1be321b2d08ac9494b7aa68 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodes.h,v 1.83 2000/11/12 00:37:01 tgl Exp $
+ * $Id: nodes.h,v 1.84 2000/11/24 20:16:40 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -202,7 +202,6 @@ typedef enum NodeTag
    T_AlterGroupStmt,
    T_DropGroupStmt,
    T_ReindexStmt,
-   T_SetSessionStmt,
    T_CheckPointStmt,
 
    T_A_Expr = 700,
index a15d4c0ad85c20180d79d6d437c411a87e577b00..67db2fe3e966687dcf8d56057c2c1c723ccafd94 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parsenodes.h,v 1.121 2000/11/14 18:37:48 tgl Exp $
+ * $Id: parsenodes.h,v 1.122 2000/11/24 20:16:40 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -697,15 +697,9 @@ typedef struct ExplainStmt
 } ExplainStmt;
 
 /* ----------------------
- *     Set Session Statement
+ * Checkpoint Statement
  * ----------------------
  */
-typedef struct SetSessionStmt
-{
-   NodeTag     type;
-   List       *args;
-} SetSessionStmt;
-
 typedef struct CheckPointStmt
 {
    NodeTag     type;