Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b2b5656

Browse files
committed
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.
1 parent 752089e commit b2b5656

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/backend/rewrite/rewriteHandler.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.140 2004/06/16 01:26:46 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.141 2004/08/07 17:40:49 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -208,7 +208,8 @@ rewriteRuleAction(Query *parsetree,
208208
* apply it to sub_action; we have to remember to update the sublink
209209
* inside rule_action, too.
210210
*/
211-
if (event == CMD_INSERT || event == CMD_UPDATE)
211+
if ((event == CMD_INSERT || event == CMD_UPDATE) &&
212+
sub_action->commandType != CMD_UTILITY)
212213
{
213214
sub_action = (Query *) ResolveNew((Node *) sub_action,
214215
new_varno,

0 commit comments

Comments
 (0)