1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Make SET SESSION CHARACTERISTICS compliant with SQL 99. Remove redundant,

non-standard clauses.  Allow CHARACTERISTICS as unquoted identifier.
Merge related reference pages.
This commit is contained in:
Peter Eisentraut
2000-11-24 20:16:40 +00:00
parent f1ddc19b10
commit 5b00ea9e50
9 changed files with 37 additions and 230 deletions

View 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;

View 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;

View 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
*------------------------

View 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 <node> select_no_parens, select_clause, simple_select
%type <list> SessionList
%type <node> SessionClause
%type <node> alter_column_action
%type <ival> 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"; }

View 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,

View 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;