ExplainModifyTarget doesn't work as expected
| От | Etsuro Fujita |
|---|---|
| Тема | ExplainModifyTarget doesn't work as expected |
| Дата | |
| Msg-id | 5497BF4C.6080302@lab.ntt.co.jp обсуждение |
| Ответы |
Re: ExplainModifyTarget doesn't work as expected
Re: ExplainModifyTarget doesn't work as expected |
| Список | pgsql-hackers |
Hi,
I think ExplainModifyTarget should show the parent of the inheritance
tree in multi-target-table cases, as described there, but noticed that
it doesn't always work like that. Here is an example.
postgres=# create table parent (a int check (a < 0) no inherit);
CREATE TABLE
postgres=# create table child (a int check (a >= 0));
CREATE TABLE
postgres=# alter table child inherit parent;
ALTER TABLE
postgres=# explain update parent set a = a * 2 where a >= 0;
QUERY PLAN
---------------------------------------------------------------
Update on child (cost=0.00..42.00 rows=800 width=10)
-> Seq Scan on child (cost=0.00..42.00 rows=800 width=10)
Filter: (a >= 0)
(3 rows)
IIUC, I think this is because ExplainModifyTarget doesn't take into
account that the parent *can* be excluded by constraint exclusion. So,
I added a field to ModifyTable to record the parent, apart from
resultRelations. (More precisely, the parent in its role as a simple
member of the inheritance tree is recorded so that appending digits to
refname in select_rtable_names_for_explain works as before.) Attached
is a proposed patch for that.
Thanks,
Best regards,
Etsuro Fujita
Вложения
В списке pgsql-hackers по дате отправления: