Don't try to rewrite NEW references in a utility statement in a rule.

There won't be any, and in fact there won't even be an RTE for NEW,
which was leading to a core dump in CVS tip.  7.4 and earlier manage
not to crash when applying ResolveNew in this scenario, but I think
it was just good fortune that they didn't.  Per report from
Bernd Helmle.
This commit is contained in:
Tom Lane 2004-08-07 17:40:49 +00:00
parent 752089ea41
commit b2b5656362
1 changed files with 3 additions and 2 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.140 2004/06/16 01:26:46 tgl Exp $
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.141 2004/08/07 17:40:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -208,7 +208,8 @@ rewriteRuleAction(Query *parsetree,
* apply it to sub_action; we have to remember to update the sublink
* inside rule_action, too.
*/
if (event == CMD_INSERT || event == CMD_UPDATE)
if ((event == CMD_INSERT || event == CMD_UPDATE) &&
sub_action->commandType != CMD_UTILITY)
{
sub_action = (Query *) ResolveNew((Node *) sub_action,
new_varno,