18:17, Tom Lane wrote:
Bennie Swart writes:
-- join elimination fails
-- expect both b and c to be eliminated, but b remains
explain (costs off)
select a.*
from foo a
left join foo b on (b.id1, b.id2) = (a.id1, a.id2)
left join foo c on (c.id1, c.id2)
We are encountering this issue which results in poor planning for some
views.
Some examples to illustrate the issue:
-- setup
create table foo as
select id1, id2
from generate_series(1, 100) id1,
generate_series(1, 100) id2;
alter table foo add unique (id1, id2);
-- join elimina
straint trigger is deferred, but
works as expected when it is immediate.
Hopefully this helps to better paint the picture. Our workaround
currently is to just make `legacy.stock_check_state()` security definer
as well. As I told Laurenz, we're not looking to advocate for any
specific outcom