Re: Wrong results from join removal with DISTINCT ON + SRF subquery - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Wrong results from join removal with DISTINCT ON + SRF subquery
Date
Msg-id 4122160.1787361352@sss.pgh.pa.us
Whole thread
In response to Wrong results from join removal with DISTINCT ON + SRF subquery  (Richard Guo <guofenglinux@gmail.com>)
List pgsql-hackers
Richard Guo <guofenglinux@gmail.com> writes:
> Attached is a patch to not rely on DISTINCT ON for distinctness if
> there are any tlist SRFs.  This is more conservative than necessary,
> since the SRFs are only postponed when there is an ORDER BY and none
> of them is in a sort/group column, but I don't think it's worth
> duplicating that logic in analyzejoins.c.

I didn't study the patch in any detail, but I concur with your
thinking here.  SRFs in the tlist are kind of a legacy usage in the
first place, so I don't feel a need to expend lots of effort on
optimizing cases like this.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Richard Guo
Date:
Subject: Wrong results from join removal with DISTINCT ON + SRF subquery
Next
From: Nitin Jadhav
Date:
Subject: Re: pg_dump: assert failure sorting casts/transforms