Re: [BUGS] BUG #14746: sub query's plan not right? - Mailing list pgsql-bugs

From Feike Steenbergen
Subject Re: [BUGS] BUG #14746: sub query's plan not right?
Date
Msg-id CAK_s-G1uKcq84DHKPJ11+N3xfVX9qS9=4McF8UtM+Ox0rF9qVg@mail.gmail.com
Whole thread Raw
In response to [BUGS] BUG #14746: sub query's plan not right?  (digoal@126.com)
List pgsql-bugs
> is this a bug ? or it can be improved?

Perhaps, for me it rings a bell of using OFFSET 0 as a hack, that at least has
the property of not changing the logic of your query:

select (t.b).aid,(t.b).val,(t.b).crt_time
from
(
  select
    (
      select b from b
        where b.aid=a.id
        order by crt_time desc limit 1
    )
  from a offset 0
) t
where (t.b).aid is not null;

Previous similar discussion:


Some other pointers:

pgsql-bugs by date:

Previous
From: Amit Langote
Date:
Subject: Re: [BUGS] BUG #14759: insert into foreign data partitions fail
Next
From: Rick Otten
Date:
Subject: [BUGS] signal 11 segfaults with parallel workers