Fix crash when trying to display a NOTIFY rule action.

Fixes oversight in commit 2ffa740be9.
Per report from Josh Kupershmidt.

I think we've broken this case before, so let's add a regression test
this time.
This commit is contained in:
Tom Lane 2013-05-16 16:47:26 -04:00
parent 6563fb2b45
commit 403bd6a18b
3 changed files with 17 additions and 7 deletions

View File

@ -2564,14 +2564,19 @@ set_deparse_for_query(deparse_namespace *dpns, Query *query,
dpns->rtable_columns = lappend(dpns->rtable_columns,
palloc0(sizeof(deparse_columns)));
/* Detect whether global uniqueness of USING names is needed */
dpns->unique_using = has_unnamed_full_join_using((Node *) query->jointree);
/* If it's a utility query, it won't have a jointree */
if (query->jointree)
{
/* Detect whether global uniqueness of USING names is needed */
dpns->unique_using =
has_unnamed_full_join_using((Node *) query->jointree);
/*
* Select names for columns merged by USING, via a recursive pass over the
* query jointree.
*/
set_using_names(dpns, (Node *) query->jointree);
/*
* Select names for columns merged by USING, via a recursive pass over
* the query jointree.
*/
set_using_names(dpns, (Node *) query->jointree);
}
/*
* Now assign remaining column aliases for each RTE. We do this in a

View File

@ -2573,6 +2573,7 @@ select * from rules_log;
11 | 13 | new
(12 rows)
create rule r3 as on delete to rules_src do notify rules_src_deletion;
\d+ rules_src
Table "public.rules_src"
Column | Type | Modifiers | Storage | Stats target | Description
@ -2584,6 +2585,9 @@ Rules:
ON UPDATE TO rules_src DO INSERT INTO rules_log (f1, f2, tag) VALUES (old.f1,old.f2,'old'::text), (new.f1,new.f2,'new'::text)
r2 AS
ON UPDATE TO rules_src DO VALUES (old.f1,old.f2,'old'::text), (new.f1,new.f2,'new'::text)
r3 AS
ON DELETE TO rules_src DO
NOTIFY rules_src_deletion
Has OIDs: no
--

View File

@ -970,6 +970,7 @@ create rule r2 as on update to rules_src do also
update rules_src set f2 = f2 / 10;
select * from rules_src;
select * from rules_log;
create rule r3 as on delete to rules_src do notify rules_src_deletion;
\d+ rules_src
--