Search Postgresql Archives

Re: array UNNESTed to rows stable with respect to order?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/17/2018 01:20 PM, Thiemo Kellner wrote:
 I use UNNEST to get rows from array. This works fine but I am
not sure whether the ordering remains in the later use.

I think you are looking for `WITH ORDINALITY` (in pg 9.4+). For instance you could rewrite your first CTE like so:

SELECT  oid as PROOID,
        PRONAME,
        t as PROARGTYPE,
        i,
        PRONAMESPACE,
        PROOWNER
FROM    PG_CATALOG.PG_PROC,
        UNNEST(PROARGTYPES) WITH ORDINALITY AS proargtypes(t, i)
;

Yours,

--
Paul              ~{:-)
pj@xxxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux