Re: BUG #15485: Order by of inlineable stable function incorrect - Mailing list pgsql-bugs

From Gavin Flower
Subject Re: BUG #15485: Order by of inlineable stable function incorrect
Date
Msg-id 48f15472-9355-d83d-9bb7-4f59a12c305e@archidevsys.co.nz
Whole thread Raw
In response to BUG #15485: Order by of inlineable stable function incorrect  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
On 04/11/2018 13:11, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference:      15485
> Logged by:          Tommas Factorylab
> Email address:      tommas@factorylab.nl
> PostgreSQL version: 9.6.10
> Operating system:   ubuntu 14.04 x64
> Description:
>
> Hi,
>
> I am encountering a problem where the resultset is not correctly ordered
> (and that results in incorrect behaviour of my application). The ordering is
> done by a table function that is referenced in the "from clause" (function
> "fA"). The query also left joins various other table functions. These table
> functions do not perform any ordering.
[...]
>
> SELECT
>     fA.c1 AS fA_c1, fA.c4 AS fA_c4, fA.c6 AS fA_c6, fA.c7 AS fA_c7, fA.c8 AS
> fA_c8,
>     fB.c1 AS fB_c1, fB.c4 AS fB_c4,
>     fC.c1 AS fC_c1, fC.c2 AS fC_c2,
>     fD.c1 AS fD_c1, fD.c4 AS fD_c4,
>     fE.c1 AS fE_c1, fE.c2 AS fE_c2,
>     fF.c1 AS fF_c1, fF.c2 AS fF_c2,
>     fG.c1 AS fG_c1, fG.c2 AS fG_c2, fG.c3 AS fG_c3, fG.c4 AS fG_c4,
>     fH.c1 AS fH_c1, fH.c2 AS fH_c2, fH.c3 AS fH_c3, fH.c4 AS fH_c4, fH.c5 AS
> fH_c5, fH.c6 AS fH_c6
> FROM fA(1) AS fA
> LEFT OUTER JOIN fB(fA.c2) AS fB ON true
> LEFT OUTER JOIN fC(fB.c3) AS fC ON true
> LEFT OUTER JOIN fD(fB.c2) AS fD ON true
> LEFT OUTER JOIN fE(fD.c2) AS fE ON true
> LEFT OUTER JOIN fF(fD.c3) AS fF ON true
> LEFT OUTER JOIN fG(fA.c3) AS fG ON true
> LEFT OUTER JOIN fH(fA.c5) AS fH ON true
>
I suspect that you still need to use an 'ORDER BY' clause.


Cheers,
Gavin



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #15485: Order by of inlineable stable function incorrect
Next
From: Andrew Gierth
Date:
Subject: Re: BUG #15485: Order by of inlineable stable function incorrect