Skip to content

Commit 60500d5

Browse files
committed
Fix breakage of rules using NOTIFY actions, per bug report and patch
from sergiop@sinectis.com.ar.
1 parent 676cf18 commit 60500d5

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/backend/rewrite/rewriteHandler.c

Lines changed: 2 additions & 1 deletion
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.86 2000/12/07 01:22:25 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.87 2001/01/03 22:01:05 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -124,6 +124,7 @@ gatherRewriteMeta(Query *parsetree,
124124
* Note that if the rule refers to OLD, its jointree will add back
125125
* a reference to rt_index.
126126
*/
127+
if (sub_action->jointree != NULL)
127128
{
128129
bool found;
129130
List *newjointree = adjustJoinTreeList(parsetree,

src/backend/utils/adt/ruleutils.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* back to source text
44
*
55
* IDENTIFICATION
6-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.70 2000/11/18 04:40:18 tgl Exp $
6+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.71 2001/01/03 22:01:05 tgl Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -97,6 +97,7 @@ static void get_select_query_def(Query *query, deparse_context *context);
9797
static void get_insert_query_def(Query *query, deparse_context *context);
9898
static void get_update_query_def(Query *query, deparse_context *context);
9999
static void get_delete_query_def(Query *query, deparse_context *context);
100+
static void get_utility_query_def(Query *query, deparse_context *context);
100101
static void get_basic_select_query(Query *query, deparse_context *context);
101102
static void get_setop_query(Node *setOp, Query *query,
102103
deparse_context *context, bool toplevel);
@@ -874,6 +875,10 @@ get_query_def(Query *query, StringInfo buf, List *parentrtables)
874875
appendStringInfo(buf, "NOTHING");
875876
break;
876877

878+
case CMD_UTILITY:
879+
get_utility_query_def(query, &context);
880+
break;
881+
877882
default:
878883
elog(ERROR, "get_ruledef of %s: query command type %d not implemented yet",
879884
rulename, query->commandType);
@@ -1310,6 +1315,26 @@ get_delete_query_def(Query *query, deparse_context *context)
13101315
}
13111316
}
13121317

1318+
1319+
/* ----------
1320+
* get_utility_query_def - Parse back a UTILITY parsetree
1321+
* ----------
1322+
*/
1323+
static void
1324+
get_utility_query_def(Query *query, deparse_context *context)
1325+
{
1326+
StringInfo buf = context->buf;
1327+
1328+
if (query->utilityStmt && IsA(query->utilityStmt, NotifyStmt))
1329+
{
1330+
NotifyStmt *stmt = (NotifyStmt *) query->utilityStmt;
1331+
appendStringInfo(buf, "NOTIFY %s", quote_identifier(stmt->relname));
1332+
}
1333+
else
1334+
elog(ERROR, "get_utility_query_def: unexpected statement type");
1335+
}
1336+
1337+
13131338
/*
13141339
* Find the RTE referenced by a (possibly nonlocal) Var.
13151340
*/

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy