Skip to content

Commit 5b00ea9

Browse files
committed
Make SET SESSION CHARACTERISTICS compliant with SQL 99. Remove redundant,
non-standard clauses. Allow CHARACTERISTICS as unquoted identifier. Merge related reference pages.
1 parent f1ddc19 commit 5b00ea9

File tree

9 files changed

+37
-230
lines changed

9 files changed

+37
-230
lines changed

doc/src/sgml/ref/allfiles.sgml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.25 2000/11/24 17:44:22 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.26 2000/11/24 20:16:38 petere Exp $
33
Postgres documentation
44
Complete list of usable sgml source files in this directory.
55
-->
@@ -95,7 +95,6 @@ Complete list of usable sgml source files in this directory.
9595
<!entity select system "select.sgml">
9696
<!entity selectInto system "select_into.sgml">
9797
<!entity set system "set.sgml">
98-
<!entity setSession system "set_session.sgml">
9998
<!entity setConstraints system "set_constraints.sgml">
10099
<!entity setTransaction system "set_transaction.sgml">
101100
<!entity show system "show.sgml">

doc/src/sgml/ref/set_session.sgml

Lines changed: 0 additions & 91 deletions
This file was deleted.

doc/src/sgml/ref/set_transaction.sgml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,41 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/set_transaction.sgml,v 1.2 2000/07/14 15:27:14 thomas Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/set_transaction.sgml,v 1.3 2000/11/24 20:16:38 petere Exp $ -->
22
<refentry id="SQL-SET-TRANSACTION">
3+
<docinfo>
4+
<date>2000-11-24</date>
5+
</docinfo>
6+
37
<refmeta>
48
<refentrytitle id="SQL-SET-TRANSACTION-TITLE">SET TRANSACTION</refentrytitle>
59
<refmiscinfo>SQL - Language Statements</refmiscinfo>
610
</refmeta>
11+
712
<refnamediv>
813
<refname>SET TRANSACTION</refname>
914
<refpurpose>Set the characteristics of the current SQL-transaction</refpurpose>
1015
</refnamediv>
16+
1117
<refsynopsisdiv>
12-
<refsynopsisdivinfo>
13-
<date>2000-06-01</date>
14-
</refsynopsisdivinfo>
1518
<synopsis>
1619
SET TRANSACTION ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE }
20+
SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE }
1721
</synopsis>
1822
</refsynopsisdiv>
1923

2024
<refsect1>
2125
<title>Description</title>
2226

2327
<para>
24-
The <command>SET TRANSACTION</command> command sets the
25-
characteristics for the current SQL-transaction. It has no effect
26-
on any subsequent transactions. This command cannot be used after
27-
the first DML statement (<command>SELECT</command>,
28-
<command>INSERT</command>, <command>DELETE</command>,
29-
<command>UPDATE</command>, <command>FETCH</command>,
30-
<command>COPY</command>) of a transaction has been executed.
28+
This command sets the transaction isolation level. The
29+
<command>SET TRANSACTION</command> command sets the characteristics
30+
for the current SQL-transaction. It has no effect on any subsequent
31+
transactions. This command cannot be used after the first DML
32+
statement (<command>SELECT</command>, <command>INSERT</command>,
33+
<command>DELETE</command>, <command>UPDATE</command>,
34+
<command>FETCH</command>, <command>COPY</command>) of a transaction
35+
has been executed. <command>SET SESSION CHARACTERISTICS</command>
36+
sets the default transaction isolation level for each transaction
37+
for a session. <command>SET TRANSACTION</command> can override it
38+
for an individual transaction.
3139
</para>
3240

3341
<para>
@@ -83,7 +91,7 @@ SET TRANSACTION ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE }
8391

8492
<para>
8593
In <acronym>SQL</acronym> there are two other transaction
86-
characteristics that can be set with this command: whether the
94+
characteristics that can be set with these commands: whether the
8795
transaction is read-only and the size of the diagnostics area.
8896
Neither of these concepts are supported in Postgres.
8997
</para>

src/backend/nodes/copyfuncs.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Portions Copyright (c) 1994, Regents of the University of California
1616
*
1717
* IDENTIFICATION
18-
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.132 2000/11/14 18:37:42 tgl Exp $
18+
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.133 2000/11/24 20:16:39 petere Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -2513,16 +2513,6 @@ _copyReindexStmt(ReindexStmt *from)
25132513
return newnode;
25142514
}
25152515

2516-
static SetSessionStmt *
2517-
_copySetSessionStmt(SetSessionStmt *from)
2518-
{
2519-
SetSessionStmt *newnode = makeNode(SetSessionStmt);
2520-
2521-
Node_Copy(from, newnode, args);
2522-
2523-
return newnode;
2524-
}
2525-
25262516

25272517
/* ****************************************************************
25282518
* pg_list.h copy functions
@@ -2922,9 +2912,6 @@ copyObject(void *from)
29222912
case T_ReindexStmt:
29232913
retval = _copyReindexStmt(from);
29242914
break;
2925-
case T_SetSessionStmt:
2926-
retval = _copySetSessionStmt(from);
2927-
break;
29282915
case T_CheckPointStmt:
29292916
retval = (void*)makeNode(CheckPointStmt);
29302917
break;

src/backend/nodes/equalfuncs.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* Portions Copyright (c) 1994, Regents of the University of California
2121
*
2222
* IDENTIFICATION
23-
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.82 2000/11/14 18:37:42 tgl Exp $
23+
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.83 2000/11/24 20:16:39 petere Exp $
2424
*
2525
*-------------------------------------------------------------------------
2626
*/
@@ -1363,15 +1363,6 @@ _equalReindexStmt(ReindexStmt *a, ReindexStmt *b)
13631363
return true;
13641364
}
13651365

1366-
static bool
1367-
_equalSetSessionStmt(SetSessionStmt *a, SetSessionStmt *b)
1368-
{
1369-
if (!equal(a->args, b->args))
1370-
return false;
1371-
1372-
return true;
1373-
}
1374-
13751366
static bool
13761367
_equalAExpr(A_Expr *a, A_Expr *b)
13771368
{
@@ -2037,9 +2028,6 @@ equal(void *a, void *b)
20372028
case T_ReindexStmt:
20382029
retval = _equalReindexStmt(a, b);
20392030
break;
2040-
case T_SetSessionStmt:
2041-
retval = _equalSetSessionStmt(a, b);
2042-
break;
20432031
case T_CheckPointStmt:
20442032
retval = true;
20452033
break;

src/backend/parser/analyze.c

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: analyze.c,v 1.167 2000/11/18 16:17:20 petere Exp $
9+
* $Id: analyze.c,v 1.168 2000/11/24 20:16:39 petere Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -208,38 +208,6 @@ transformStmt(ParseState *pstate, Node *parseTree)
208208
result = transformAlterTableStmt(pstate, (AlterTableStmt *) parseTree);
209209
break;
210210

211-
case T_SetSessionStmt:
212-
{
213-
List *l;
214-
/* Session is a list of SetVariable nodes
215-
* so just run through the list.
216-
*/
217-
SetSessionStmt *stmt = (SetSessionStmt *) parseTree;
218-
219-
l = stmt->args;
220-
/* First check for duplicate keywords (disallowed by SQL99) */
221-
while (l != NULL)
222-
{
223-
VariableSetStmt *v = (VariableSetStmt *) lfirst(l);
224-
List *ll = lnext(l);
225-
while (ll != NULL)
226-
{
227-
VariableSetStmt *vv = (VariableSetStmt *) lfirst(ll);
228-
if (strcmp(v->name, vv->name) == 0)
229-
elog(ERROR, "SET SESSION CHARACTERISTICS duplicated entry not allowed");
230-
ll = lnext(ll);
231-
}
232-
l = lnext(l);
233-
}
234-
235-
l = stmt->args;
236-
result = transformStmt(pstate, lfirst(l));
237-
l = lnext(l);
238-
if (l != NULL)
239-
extras_after = lappend(extras_after, lfirst(l));
240-
}
241-
break;
242-
243211
/*------------------------
244212
* Optimizable statements
245213
*------------------------

src/backend/parser/gram.y

Lines changed: 10 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.209 2000/11/14 18:37:49 tgl Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.210 2000/11/24 20:16:39 petere Exp $
1515
*
1616
* HISTORY
1717
* AUTHOR DATE MAJOR EVENT
@@ -134,15 +134,12 @@ static void doNegateFloat(Value *v);
134134
NotifyStmt, OptimizableStmt, ProcedureStmt, ReindexStmt,
135135
RemoveAggrStmt, RemoveFuncStmt, RemoveOperStmt,
136136
RenameStmt, RevokeStmt, RuleActionStmt, RuleActionStmtOrEmpty,
137-
RuleStmt, SelectStmt, SetSessionStmt, TransactionStmt, TruncateStmt,
137+
RuleStmt, SelectStmt, TransactionStmt, TruncateStmt,
138138
UnlistenStmt, UpdateStmt, VacuumStmt, VariableResetStmt,
139139
VariableSetStmt, VariableShowStmt, ViewStmt, CheckPointStmt
140140

141141
%type <node> select_no_parens, select_clause, simple_select
142142

143-
%type <list> SessionList
144-
%type <node> SessionClause
145-
146143
%type <node> alter_column_action
147144
%type <ival> drop_behavior
148145

@@ -459,7 +456,6 @@ stmt : AlterSchemaStmt
459456
| RevokeStmt
460457
| OptimizableStmt
461458
| RuleStmt
462-
| SetSessionStmt
463459
| TransactionStmt
464460
| ViewStmt
465461
| LoadStmt
@@ -706,55 +702,6 @@ DropSchemaStmt: DROP SCHEMA UserId
706702
}
707703

708704

709-
/*****************************************************************************
710-
*
711-
* Manipulate a postgresql session
712-
*
713-
*
714-
*****************************************************************************/
715-
716-
SetSessionStmt: SET SESSION CHARACTERISTICS AS SessionList
717-
{
718-
SetSessionStmt *n = makeNode(SetSessionStmt);
719-
n->args = $5;
720-
$$ = (Node*)n;
721-
}
722-
;
723-
724-
SessionList: SessionList ',' SessionClause
725-
{
726-
$$ = lappend($1, $3);
727-
}
728-
| SessionClause
729-
{
730-
$$ = makeList1($1);
731-
}
732-
;
733-
734-
SessionClause: TRANSACTION COMMIT opt_boolean
735-
{
736-
VariableSetStmt *n = makeNode(VariableSetStmt);
737-
n->name = "autocommit";
738-
n->value = $3;
739-
$$ = (Node *) n;
740-
}
741-
| TIME ZONE zone_value
742-
{
743-
VariableSetStmt *n = makeNode(VariableSetStmt);
744-
n->name = "timezone";
745-
n->value = $3;
746-
$$ = (Node *) n;
747-
}
748-
| TRANSACTION ISOLATION LEVEL opt_level
749-
{
750-
VariableSetStmt *n = makeNode(VariableSetStmt);
751-
n->name = "DefaultXactIsoLevel";
752-
n->value = $4;
753-
$$ = (Node *) n;
754-
}
755-
;
756-
757-
758705
/*****************************************************************************
759706
*
760707
* Set PG internal variable
@@ -792,6 +739,13 @@ VariableSetStmt: SET ColId TO var_value
792739
n->value = $5;
793740
$$ = (Node *) n;
794741
}
742+
| SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL opt_level
743+
{
744+
VariableSetStmt *n = makeNode(VariableSetStmt);
745+
n->name = "DefaultXactIsoLevel";
746+
n->value = $8;
747+
$$ = (Node *) n;
748+
}
795749
| SET NAMES opt_encoding
796750
{
797751
VariableSetStmt *n = makeNode(VariableSetStmt);
@@ -5444,6 +5398,7 @@ TokenId: ABSOLUTE { $$ = "absolute"; }
54445398
| CACHE { $$ = "cache"; }
54455399
| CASCADE { $$ = "cascade"; }
54465400
| CHAIN { $$ = "chain"; }
5401+
| CHARACTERISTICS { $$ = "characteristics"; }
54475402
| CHECKPOINT { $$ = "checkpoint"; }
54485403
| CLOSE { $$ = "close"; }
54495404
| COMMENT { $$ = "comment"; }

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy