mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
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:
@ -2564,14 +2564,19 @@ set_deparse_for_query(deparse_namespace *dpns, Query *query,
|
|||||||
dpns->rtable_columns = lappend(dpns->rtable_columns,
|
dpns->rtable_columns = lappend(dpns->rtable_columns,
|
||||||
palloc0(sizeof(deparse_columns)));
|
palloc0(sizeof(deparse_columns)));
|
||||||
|
|
||||||
|
/* If it's a utility query, it won't have a jointree */
|
||||||
|
if (query->jointree)
|
||||||
|
{
|
||||||
/* Detect whether global uniqueness of USING names is needed */
|
/* Detect whether global uniqueness of USING names is needed */
|
||||||
dpns->unique_using = has_unnamed_full_join_using((Node *) query->jointree);
|
dpns->unique_using =
|
||||||
|
has_unnamed_full_join_using((Node *) query->jointree);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Select names for columns merged by USING, via a recursive pass over the
|
* Select names for columns merged by USING, via a recursive pass over
|
||||||
* query jointree.
|
* the query jointree.
|
||||||
*/
|
*/
|
||||||
set_using_names(dpns, (Node *) query->jointree);
|
set_using_names(dpns, (Node *) query->jointree);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now assign remaining column aliases for each RTE. We do this in a
|
* Now assign remaining column aliases for each RTE. We do this in a
|
||||||
|
@ -2573,6 +2573,7 @@ select * from rules_log;
|
|||||||
11 | 13 | new
|
11 | 13 | new
|
||||||
(12 rows)
|
(12 rows)
|
||||||
|
|
||||||
|
create rule r3 as on delete to rules_src do notify rules_src_deletion;
|
||||||
\d+ rules_src
|
\d+ rules_src
|
||||||
Table "public.rules_src"
|
Table "public.rules_src"
|
||||||
Column | Type | Modifiers | Storage | Stats target | Description
|
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)
|
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
|
r2 AS
|
||||||
ON UPDATE TO rules_src DO VALUES (old.f1,old.f2,'old'::text), (new.f1,new.f2,'new'::text)
|
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
|
Has OIDs: no
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -970,6 +970,7 @@ create rule r2 as on update to rules_src do also
|
|||||||
update rules_src set f2 = f2 / 10;
|
update rules_src set f2 = f2 / 10;
|
||||||
select * from rules_src;
|
select * from rules_src;
|
||||||
select * from rules_log;
|
select * from rules_log;
|
||||||
|
create rule r3 as on delete to rules_src do notify rules_src_deletion;
|
||||||
\d+ rules_src
|
\d+ rules_src
|
||||||
|
|
||||||
--
|
--
|
||||||
|
Reference in New Issue
Block a user