1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-14 08:21:07 +03:00

Rename rule CURRENT to OLD in source tree. Add mapping for backward

compatiblity with old rules.
This commit is contained in:
Bruce Momjian
2000-06-12 19:40:58 +00:00
parent 767e6d17b4
commit 332f0f5fc0
12 changed files with 94 additions and 91 deletions

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.146 2000/06/09 01:44:18 momjian Exp $
* $Id: analyze.c,v 1.147 2000/06/12 19:40:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -1351,7 +1351,7 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt)
nothing_qry->commandType = CMD_NOTHING;
addRangeTableEntry(pstate, stmt->object->relname,
makeAttr("*CURRENT*", NULL),
makeAttr("*OLD*", NULL),
FALSE, FALSE, FALSE);
addRangeTableEntry(pstate, stmt->object->relname,
makeAttr("*NEW*", NULL),
@ -1371,11 +1371,11 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt)
{
/*
* NOTE: 'CURRENT' must always have a varno equal to 1 and 'NEW'
* NOTE: 'OLD' must always have a varno equal to 1 and 'NEW'
* equal to 2.
*/
addRangeTableEntry(pstate, stmt->object->relname,
makeAttr("*CURRENT*", NULL),
makeAttr("*OLD*", NULL),
FALSE, FALSE, FALSE);
addRangeTableEntry(pstate, stmt->object->relname,
makeAttr("*NEW*", NULL),

View File

@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.172 2000/06/12 03:40:30 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.173 2000/06/12 19:40:40 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@ -298,7 +298,7 @@ static void doNegateFloat(Value *v);
BEGIN_TRANS, BETWEEN, BOTH, BY,
CASCADE, CASE, CAST, CHAR, CHARACTER, CHECK, CLOSE,
COALESCE, COLLATE, COLUMN, COMMIT,
CONSTRAINT, CONSTRAINTS, CREATE, CROSS, CURRENT, CURRENT_DATE,
CONSTRAINT, CONSTRAINTS, CREATE, CROSS, CURRENT_DATE,
CURRENT_TIME, CURRENT_TIMESTAMP, CURRENT_USER, CURSOR,
DAY_P, DEC, DECIMAL, DECLARE, DEFAULT, DELETE, DESC,
DISTINCT, DOUBLE, DROP,
@ -309,7 +309,7 @@ static void doNegateFloat(Value *v);
ISOLATION, JOIN, KEY, LANGUAGE, LEADING, LEFT, LEVEL, LIKE, LOCAL,
MATCH, MINUTE_P, MONTH_P, NAMES,
NATIONAL, NATURAL, NCHAR, NEXT, NO, NOT, NULLIF, NULL_P, NUMERIC,
OF, ON, ONLY, OPTION, OR, ORDER, OUTER_P, OVERLAPS,
OF, OLD, ON, ONLY, OPTION, OR, ORDER, OUTER_P, OVERLAPS,
PARTIAL, POSITION, PRECISION, PRIMARY, PRIOR, PRIVILEGES, PROCEDURE, PUBLIC,
READ, REFERENCES, RELATIVE, REVOKE, RIGHT, ROLLBACK,
SCROLL, SECOND_P, SELECT, SESSION_USER, SET, SOME, SUBSTRING,
@ -5509,7 +5509,6 @@ ColLabel: ColId { $$ = $1; }
| CONSTRAINT { $$ = "constraint"; }
| COPY { $$ = "copy"; }
| CROSS { $$ = "cross"; }
| CURRENT { $$ = "current"; }
| CURRENT_DATE { $$ = "current_date"; }
| CURRENT_TIME { $$ = "current_time"; }
| CURRENT_TIMESTAMP { $$ = "current_timestamp"; }
@ -5564,6 +5563,7 @@ ColLabel: ColId { $$ = $1; }
| NUMERIC { $$ = "numeric"; }
| OFF { $$ = "off"; }
| OFFSET { $$ = "offset"; }
| OLD { $$ = "old"; }
| ON { $$ = "on"; }
| ONLY { $$ = "only"; }
| OR { $$ = "or"; }
@ -5601,12 +5601,12 @@ ColLabel: ColId { $$ = $1; }
| WHERE { $$ = "where"; }
;
SpecialRuleRelation: CURRENT
SpecialRuleRelation: OLD
{
if (QueryIsRule)
$$ = "*CURRENT*";
$$ = "*OLD*";
else
elog(ERROR,"CURRENT used in non-rule query");
elog(ERROR,"OLD used in non-rule query");
}
| NEW
{

View File

@ -9,9 +9,9 @@
*
* IDENTIFICATION
<<<<<<< keywords.c
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.76 2000/06/12 03:40:30 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.77 2000/06/12 19:40:41 momjian Exp $
=======
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.76 2000/06/12 03:40:30 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.77 2000/06/12 19:40:41 momjian Exp $
>>>>>>> 1.73
*
*-------------------------------------------------------------------------
@ -77,6 +77,8 @@ static ScanKeyword ScanKeywords[] = {
{"createdb", CREATEDB},
{"createuser", CREATEUSER},
{"cross", CROSS},
/* for portability with old rules bjm 2000-06-12 */
{"current", OLD},
{"current_date", CURRENT_DATE},
{"current_time", CURRENT_TIME},
{"current_timestamp", CURRENT_TIMESTAMP},
@ -183,7 +185,7 @@ static ScanKeyword ScanKeywords[] = {
{"off", OFF},
{"offset", OFFSET},
{"oids", OIDS},
{"old", CURRENT},
{"old", OLD},
{"on", ON},
{"only", ONLY},
{"operator", OPERATOR},

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.42 2000/06/08 22:37:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.43 2000/06/12 19:40:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -250,7 +250,7 @@ addRangeTableEntry(ParseState *pstate,
if (rt_index != 0 && (!inFromCl || sublevels_up == 0))
{
if (!strcmp(ref->relname, "*CURRENT*") || !strcmp(ref->relname, "*NEW*"))
if (!strcmp(ref->relname, "*OLD*") || !strcmp(ref->relname, "*NEW*"))
return (RangeTblEntry *) nth(rt_index - 1, pstate->p_rtable);
elog(ERROR, "Table name '%s' specified more than once", ref->relname);
}