mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-11-27 07:21:09 +08:00
Fix breakage of rules using NOTIFY actions, per bug report and patch
from sergiop@sinectis.com.ar.
This commit is contained in:
parent
676cf18c5b
commit
60500d58bc
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.86 2000/12/07 01:22:25 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.87 2001/01/03 22:01:05 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -124,6 +124,7 @@ gatherRewriteMeta(Query *parsetree,
|
||||
* Note that if the rule refers to OLD, its jointree will add back
|
||||
* a reference to rt_index.
|
||||
*/
|
||||
if (sub_action->jointree != NULL)
|
||||
{
|
||||
bool found;
|
||||
List *newjointree = adjustJoinTreeList(parsetree,
|
||||
|
@ -3,7 +3,7 @@
|
||||
* back to source text
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.70 2000/11/18 04:40:18 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.71 2001/01/03 22:01:05 tgl Exp $
|
||||
*
|
||||
* This software is copyrighted by Jan Wieck - Hamburg.
|
||||
*
|
||||
@ -97,6 +97,7 @@ static void get_select_query_def(Query *query, deparse_context *context);
|
||||
static void get_insert_query_def(Query *query, deparse_context *context);
|
||||
static void get_update_query_def(Query *query, deparse_context *context);
|
||||
static void get_delete_query_def(Query *query, deparse_context *context);
|
||||
static void get_utility_query_def(Query *query, deparse_context *context);
|
||||
static void get_basic_select_query(Query *query, deparse_context *context);
|
||||
static void get_setop_query(Node *setOp, Query *query,
|
||||
deparse_context *context, bool toplevel);
|
||||
@ -874,6 +875,10 @@ get_query_def(Query *query, StringInfo buf, List *parentrtables)
|
||||
appendStringInfo(buf, "NOTHING");
|
||||
break;
|
||||
|
||||
case CMD_UTILITY:
|
||||
get_utility_query_def(query, &context);
|
||||
break;
|
||||
|
||||
default:
|
||||
elog(ERROR, "get_ruledef of %s: query command type %d not implemented yet",
|
||||
rulename, query->commandType);
|
||||
@ -1310,6 +1315,26 @@ get_delete_query_def(Query *query, deparse_context *context)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ----------
|
||||
* get_utility_query_def - Parse back a UTILITY parsetree
|
||||
* ----------
|
||||
*/
|
||||
static void
|
||||
get_utility_query_def(Query *query, deparse_context *context)
|
||||
{
|
||||
StringInfo buf = context->buf;
|
||||
|
||||
if (query->utilityStmt && IsA(query->utilityStmt, NotifyStmt))
|
||||
{
|
||||
NotifyStmt *stmt = (NotifyStmt *) query->utilityStmt;
|
||||
appendStringInfo(buf, "NOTIFY %s", quote_identifier(stmt->relname));
|
||||
}
|
||||
else
|
||||
elog(ERROR, "get_utility_query_def: unexpected statement type");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Find the RTE referenced by a (possibly nonlocal) Var.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user