1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-03 15:22:11 +03:00

Don't treat NEW and OLD as reserved words anymore. For the purposes of rules

it works just as well to have them be ordinary identifiers, and this gets rid
of a number of ugly special cases.  Plus we aren't interfering with non-rule
usage of these names.

catversion bump because the names change internally in stored rules.
This commit is contained in:
Tom Lane
2009-11-05 23:24:27 +00:00
parent 45d7e04fce
commit 593f4b854a
18 changed files with 84 additions and 156 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.124 2009/10/26 02:26:38 tgl Exp $
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.125 2009/11/05 23:24:24 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -940,15 +940,15 @@ getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr)
/*
* Currently, this is ONLY applied to rule-action queries, and so we
* expect to find the *OLD* and *NEW* placeholder entries in the given
* expect to find the OLD and NEW placeholder entries in the given
* query. If they're not there, it must be an INSERT/SELECT in which
* they've been pushed down to the SELECT.
*/
if (list_length(parsetree->rtable) >= 2 &&
strcmp(rt_fetch(PRS2_OLD_VARNO, parsetree->rtable)->eref->aliasname,
"*OLD*") == 0 &&
"old") == 0 &&
strcmp(rt_fetch(PRS2_NEW_VARNO, parsetree->rtable)->eref->aliasname,
"*NEW*") == 0)
"new") == 0)
return parsetree;
Assert(parsetree->jointree && IsA(parsetree->jointree, FromExpr));
if (list_length(parsetree->jointree->fromlist) != 1)
@@ -962,9 +962,9 @@ getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr)
elog(ERROR, "expected to find SELECT subquery");
if (list_length(selectquery->rtable) >= 2 &&
strcmp(rt_fetch(PRS2_OLD_VARNO, selectquery->rtable)->eref->aliasname,
"*OLD*") == 0 &&
"old") == 0 &&
strcmp(rt_fetch(PRS2_NEW_VARNO, selectquery->rtable)->eref->aliasname,
"*NEW*") == 0)
"new") == 0)
{
if (subquery_ptr)
*subquery_ptr = &(selectrte->subquery);