Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit332f0f5

Browse files
committed
Rename rule CURRENT to OLD in source tree. Add mapping for backward
compatiblity with old rules.
1 parent767e6d1 commit332f0f5

File tree

12 files changed

+94
-91
lines changed

12 files changed

+94
-91
lines changed

‎src/backend/commands/view.c

Lines changed: 5 additions & 5 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: view.c,v 1.42 2000/02/15 03:36:39 thomas Exp $
9+
*$Id: view.c,v 1.43 2000/06/12 19:40:40 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -189,7 +189,7 @@ DefineViewRules(char *viewName, Query *viewParse)
189189
* This update consists of adding two new entries IN THE BEGINNING
190190
* of the range table (otherwise the rule system will die a slow,
191191
* horrible and painful death, and we do not want that now, do we?)
192-
* one for theCURRENT relation and one for the NEW one (both of
192+
* one for theOLD relation and one for the NEW one (both of
193193
* them refer in fact to the "view" relation).
194194
*
195195
* Of course we must also increase the 'varnos' of all the Var nodes
@@ -224,10 +224,10 @@ UpdateRangeTableOfViewParse(char *viewName, Query *viewParse)
224224

225225
/*
226226
* create the 2 new range table entries and form the new range
227-
* table...CURRENT first, then NEW....
227+
* table...OLD first, then NEW....
228228
*/
229229
rt_entry1=addRangeTableEntry(NULL, (char*)viewName,
230-
makeAttr("*CURRENT*",NULL),
230+
makeAttr("*OLD*",NULL),
231231
FALSE, FALSE, FALSE);
232232
rt_entry2=addRangeTableEntry(NULL, (char*)viewName,
233233
makeAttr("*NEW*",NULL),
@@ -276,7 +276,7 @@ DefineView(char *viewName, Query *viewParse)
276276

277277
/*
278278
* The range table of 'viewParse' does not contain entries for the
279-
* "CURRENT" and "NEW" relations. So... add them! NOTE: we make the
279+
* "OLD" and "NEW" relations. So... add them! NOTE: we make the
280280
* update in place! After this call 'viewParse' will never be what it
281281
* used to be...
282282
*/

‎src/backend/parser/analyze.c

Lines changed: 4 additions & 4 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.146 2000/06/09 01:44:18 momjian Exp $
9+
*$Id: analyze.c,v 1.147 2000/06/12 19:40:40 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -1351,7 +1351,7 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt)
13511351
nothing_qry->commandType=CMD_NOTHING;
13521352

13531353
addRangeTableEntry(pstate,stmt->object->relname,
1354-
makeAttr("*CURRENT*",NULL),
1354+
makeAttr("*OLD*",NULL),
13551355
FALSE, FALSE, FALSE);
13561356
addRangeTableEntry(pstate,stmt->object->relname,
13571357
makeAttr("*NEW*",NULL),
@@ -1371,11 +1371,11 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt)
13711371
{
13721372

13731373
/*
1374-
* NOTE: 'CURRENT' must always have a varno equal to 1 and 'NEW'
1374+
* NOTE: 'OLD' must always have a varno equal to 1 and 'NEW'
13751375
* equal to 2.
13761376
*/
13771377
addRangeTableEntry(pstate,stmt->object->relname,
1378-
makeAttr("*CURRENT*",NULL),
1378+
makeAttr("*OLD*",NULL),
13791379
FALSE, FALSE, FALSE);
13801380
addRangeTableEntry(pstate,stmt->object->relname,
13811381
makeAttr("*NEW*",NULL),

‎src/backend/parser/gram.y

Lines changed: 7 additions & 7 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.172 2000/06/1203:40:30 momjian Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.173 2000/06/1219:40:40 momjian Exp $
1515
*
1616
* HISTORY
1717
* AUTHORDATEMAJOR EVENT
@@ -298,7 +298,7 @@ static void doNegateFloat(Value *v);
298298
BEGIN_TRANS,BETWEEN,BOTH,BY,
299299
CASCADE,CASE,CAST,CHAR,CHARACTER,CHECK,CLOSE,
300300
COALESCE,COLLATE,COLUMN,COMMIT,
301-
CONSTRAINT,CONSTRAINTS,CREATE,CROSS,CURRENT,CURRENT_DATE,
301+
CONSTRAINT,CONSTRAINTS,CREATE,CROSS,CURRENT_DATE,
302302
CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,CURSOR,
303303
DAY_P,DEC,DECIMAL,DECLARE,DEFAULT,DELETE,DESC,
304304
DISTINCT,DOUBLE,DROP,
@@ -309,7 +309,7 @@ static void doNegateFloat(Value *v);
309309
ISOLATION,JOIN,KEY,LANGUAGE,LEADING,LEFT,LEVEL,LIKE,LOCAL,
310310
MATCH,MINUTE_P,MONTH_P,NAMES,
311311
NATIONAL,NATURAL,NCHAR,NEXT,NO,NOT,NULLIF,NULL_P,NUMERIC,
312-
OF,ON,ONLY,OPTION,OR,ORDER,OUTER_P,OVERLAPS,
312+
OF,OLD,ON,ONLY,OPTION,OR,ORDER,OUTER_P,OVERLAPS,
313313
PARTIAL,POSITION,PRECISION,PRIMARY,PRIOR,PRIVILEGES,PROCEDURE,PUBLIC,
314314
READ,REFERENCES,RELATIVE,REVOKE,RIGHT,ROLLBACK,
315315
SCROLL,SECOND_P,SELECT,SESSION_USER,SET,SOME,SUBSTRING,
@@ -5509,7 +5509,6 @@ ColLabel: ColId{ $$ = $1; }
55095509
|CONSTRAINT{$$ ="constraint"; }
55105510
|COPY{$$ ="copy"; }
55115511
|CROSS{$$ ="cross"; }
5512-
|CURRENT{$$ ="current"; }
55135512
|CURRENT_DATE{$$ ="current_date"; }
55145513
|CURRENT_TIME{$$ ="current_time"; }
55155514
|CURRENT_TIMESTAMP{$$ ="current_timestamp"; }
@@ -5564,6 +5563,7 @@ ColLabel: ColId{ $$ = $1; }
55645563
|NUMERIC{$$ ="numeric"; }
55655564
|OFF{$$ ="off"; }
55665565
|OFFSET{$$ ="offset"; }
5566+
|OLD{$$ ="old"; }
55675567
|ON{$$ ="on"; }
55685568
|ONLY{$$ ="only"; }
55695569
|OR{$$ ="or"; }
@@ -5601,12 +5601,12 @@ ColLabel: ColId{ $$ = $1; }
56015601
|WHERE{$$ ="where"; }
56025602
;
56035603

5604-
SpecialRuleRelation:CURRENT
5604+
SpecialRuleRelation:OLD
56055605
{
56065606
if (QueryIsRule)
5607-
$$ ="*CURRENT*";
5607+
$$ ="*OLD*";
56085608
else
5609-
elog(ERROR,"CURRENT used in non-rule query");
5609+
elog(ERROR,"OLD used in non-rule query");
56105610
}
56115611
|NEW
56125612
{

‎src/backend/parser/keywords.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
*
1010
* IDENTIFICATION
1111
<<<<<<< keywords.c
12-
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.76 2000/06/1203:40:30 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.77 2000/06/1219:40:41 momjian Exp $
1313
=======
14-
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.76 2000/06/1203:40:30 momjian Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.77 2000/06/1219:40:41 momjian Exp $
1515
>>>>>>> 1.73
1616
*
1717
*-------------------------------------------------------------------------
@@ -77,6 +77,8 @@ static ScanKeyword ScanKeywords[] = {
7777
{"createdb",CREATEDB},
7878
{"createuser",CREATEUSER},
7979
{"cross",CROSS},
80+
/* for portability with old rules bjm 2000-06-12 */
81+
{"current",OLD},
8082
{"current_date",CURRENT_DATE},
8183
{"current_time",CURRENT_TIME},
8284
{"current_timestamp",CURRENT_TIMESTAMP},
@@ -183,7 +185,7 @@ static ScanKeyword ScanKeywords[] = {
183185
{"off",OFF},
184186
{"offset",OFFSET},
185187
{"oids",OIDS},
186-
{"old",CURRENT},
188+
{"old",OLD},
187189
{"on",ON},
188190
{"only",ONLY},
189191
{"operator",OPERATOR},

‎src/backend/parser/parse_relation.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.42 2000/06/08 22:37:18 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.43 2000/06/12 19:40:42 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -250,7 +250,7 @@ addRangeTableEntry(ParseState *pstate,
250250

251251
if (rt_index!=0&& (!inFromCl||sublevels_up==0))
252252
{
253-
if (!strcmp(ref->relname,"*CURRENT*")|| !strcmp(ref->relname,"*NEW*"))
253+
if (!strcmp(ref->relname,"*OLD*")|| !strcmp(ref->relname,"*NEW*"))
254254
return (RangeTblEntry*)nth(rt_index-1,pstate->p_rtable);
255255
elog(ERROR,"Table name '%s' specified more than once",ref->relname);
256256
}

‎src/backend/rewrite/rewriteHandler.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.74 2000/05/30 00:49:51 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.75 2000/06/12 19:40:42 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -107,11 +107,11 @@ gatherRewriteMeta(Query *parsetree,
107107
OffsetVarNodes((Node*)info->rule_action->targetList,rt_length,0);
108108
OffsetVarNodes(info->rule_qual,rt_length,0);
109109
ChangeVarNodes((Node*)info->rule_action->qual,
110-
PRS2_CURRENT_VARNO+rt_length,rt_index,0);
110+
PRS2_OLD_VARNO+rt_length,rt_index,0);
111111
ChangeVarNodes((Node*)info->rule_action->targetList,
112-
PRS2_CURRENT_VARNO+rt_length,rt_index,0);
112+
PRS2_OLD_VARNO+rt_length,rt_index,0);
113113
ChangeVarNodes(info->rule_qual,
114-
PRS2_CURRENT_VARNO+rt_length,rt_index,0);
114+
PRS2_OLD_VARNO+rt_length,rt_index,0);
115115

116116
/*
117117
* bug here about replace CURRENT -- sort of replace current is
@@ -125,7 +125,7 @@ gatherRewriteMeta(Query *parsetree,
125125
result_reln=info->rule_action->resultRelation;
126126
switch (result_reln)
127127
{
128-
casePRS2_CURRENT_VARNO:
128+
casePRS2_OLD_VARNO:
129129
new_result_reln=rt_index;
130130
break;
131131
casePRS2_NEW_VARNO:/* XXX */
@@ -796,9 +796,9 @@ ApplyRetrieveRule(Query *parsetree,
796796
OffsetVarNodes((Node*)rule_action,rt_length,0);
797797

798798
ChangeVarNodes((Node*)rule_qual,
799-
PRS2_CURRENT_VARNO+rt_length,rt_index,0);
799+
PRS2_OLD_VARNO+rt_length,rt_index,0);
800800
ChangeVarNodes((Node*)rule_action,
801-
PRS2_CURRENT_VARNO+rt_length,rt_index,0);
801+
PRS2_OLD_VARNO+rt_length,rt_index,0);
802802

803803
if (relation_level)
804804
{
@@ -1061,7 +1061,7 @@ CopyAndAddQual(Query *parsetree,
10611061
rtable=nconc(rtable,copyObject(rule_action->rtable));
10621062
new_tree->rtable=rtable;
10631063
OffsetVarNodes(new_qual,rt_length,0);
1064-
ChangeVarNodes(new_qual,PRS2_CURRENT_VARNO+rt_length,rt_index,0);
1064+
ChangeVarNodes(new_qual,PRS2_OLD_VARNO+rt_length,rt_index,0);
10651065
}
10661066
/* XXX -- where current doesn't work for instead nothing.... yet */
10671067
AddNotQual(new_tree,new_qual);

‎src/backend/utils/adt/ruleutils.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* out of its tuple
44
*
55
* IDENTIFICATION
6-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.52 2000/06/10 05:17:23 tgl Exp $
6+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.53 2000/06/12 19:40:43 momjian Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -912,7 +912,7 @@ get_select_query_def(Query *query, deparse_context *context)
912912

913913
/* ----------
914914
* Now check if any of the used rangetable entries is different
915-
* from *NEW* and *CURRENT*. If so we must provide the FROM clause
915+
* from *NEW* and *OLD*. If so we must provide the FROM clause
916916
* later.
917917
* ----------
918918
*/
@@ -927,7 +927,7 @@ get_select_query_def(Query *query, deparse_context *context)
927927
continue;
928928
if (!strcmp(rte->ref->relname,"*NEW*"))
929929
continue;
930-
if (!strcmp(rte->ref->relname,"*CURRENT*"))
930+
if (!strcmp(rte->ref->relname,"*OLD*"))
931931
continue;
932932

933933
rt_constonly= FALSE;
@@ -973,7 +973,7 @@ get_select_query_def(Query *query, deparse_context *context)
973973
quote_identifier(tle->resdom->resname));
974974
}
975975

976-
/* If we need other tables than *NEW* or *CURRENT* add the FROM clause */
976+
/* If we need other tables than *NEW* or *OLD* add the FROM clause */
977977
if (!rt_constonly&&rt_numused>0)
978978
{
979979
sep=" FROM ";
@@ -988,7 +988,7 @@ get_select_query_def(Query *query, deparse_context *context)
988988
continue;
989989
if (!strcmp(rte->ref->relname,"*NEW*"))
990990
continue;
991-
if (!strcmp(rte->ref->relname,"*CURRENT*"))
991+
if (!strcmp(rte->ref->relname,"*OLD*"))
992992
continue;
993993

994994
appendStringInfo(buf,sep);
@@ -1074,7 +1074,7 @@ get_insert_query_def(Query *query, deparse_context *context)
10741074
List*l;
10751075

10761076
/* ----------
1077-
* We need to know if other tables than *NEW* or *CURRENT*
1077+
* We need to know if other tables than *NEW* or *OLD*
10781078
* are used in the query. If not, it's an INSERT ... VALUES,
10791079
* otherwise an INSERT ... SELECT.
10801080
* ----------
@@ -1105,7 +1105,7 @@ get_insert_query_def(Query *query, deparse_context *context)
11051105
continue;
11061106
if (!strcmp(rte->ref->relname,"*NEW*"))
11071107
continue;
1108-
if (!strcmp(rte->ref->relname,"*CURRENT*"))
1108+
if (!strcmp(rte->ref->relname,"*OLD*"))
11091109
continue;
11101110

11111111
rt_constonly= FALSE;
@@ -1278,7 +1278,7 @@ get_rule_expr(Node *node, deparse_context *context)
12781278
quote_identifier(rte->relname));
12791279
elseif (!strcmp(rte->ref->relname,"*NEW*"))
12801280
appendStringInfo(buf,"new.");
1281-
elseif (!strcmp(rte->ref->relname,"*CURRENT*"))
1281+
elseif (!strcmp(rte->ref->relname,"*OLD*"))
12821282
appendStringInfo(buf,"old.");
12831283
else
12841284
appendStringInfo(buf,"%s.",

‎src/include/nodes/primnodes.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: primnodes.h,v 1.42 2000/05/25 22:42:19 tgl Exp $
10+
* $Id: primnodes.h,v 1.43 2000/06/12 19:40:49 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -142,8 +142,8 @@ typedef struct Expr
142142
#defineINNER65000
143143
#defineOUTER65001
144144

145-
#definePRS2_CURRENT_VARNO1
146-
#definePRS2_NEW_VARNO2
145+
#definePRS2_OLD_VARNO1
146+
#definePRS2_NEW_VARNO2
147147

148148
typedefstructVar
149149
{

‎src/include/parser/parsetree.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $Id: parsetree.h,v 1.9 2000/02/15 03:38:29 thomas Exp $
11+
* $Id: parsetree.h,v 1.10 2000/06/12 19:40:51 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -39,7 +39,7 @@
3939
*/
4040

4141
#definert_relname(rt_entry) \
42-
((!strcmp(((rt_entry)->ref->relname),"*CURRENT*") ||\
42+
((!strcmp(((rt_entry)->ref->relname),"*OLD*") ||\
4343
!strcmp(((rt_entry)->ref->relname),"*NEW*")) ? ((rt_entry)->ref->relname) : \
4444
((char *)(rt_entry)->relname))
4545

‎src/interfaces/ecpg/preproc/keywords.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.27 2000/06/09 01:44:31 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.28 2000/06/12 19:40:55 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -73,6 +73,8 @@ static ScanKeyword ScanKeywords[] = {
7373
{"createdb",CREATEDB},
7474
{"createuser",CREATEUSER},
7575
{"cross",CROSS},
76+
/* for portability with old rules bjm 2000-06-12 */
77+
{"current",OLD},
7678
{"current_date",CURRENT_DATE},
7779
{"current_time",CURRENT_TIME},
7880
{"current_timestamp",CURRENT_TIMESTAMP},
@@ -178,7 +180,7 @@ static ScanKeyword ScanKeywords[] = {
178180
{"of",OF},
179181
{"offset",OFFSET},
180182
{"oids",OIDS},
181-
{"old",CURRENT},
183+
{"old",OLD},
182184
{"on",ON},
183185
{"only",ONLY},
184186
{"operator",OPERATOR},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp