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

Поиск
Список
Период
Сортировка
От Paul Jungwirth
Тема Re: array UNNESTed to rows stable with respect to order?
Дата
Msg-id f7d33a67-6c1a-e101-0391-aeaa6b3c04a6@illuminatedcomputing.com
обсуждение исходный текст
Ответ на array UNNESTed to rows stable with respect to order?  (Thiemo Kellner <thiemo@gelassene-pferde.biz>)
Ответы Re: array UNNESTed to rows stable with respect to order?  (Thiemo Kellner <thiemo@gelassene-pferde.biz>)
Список pgsql-general
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@illuminatedcomputing.com


В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: array UNNESTed to rows stable with respect to order?
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: rehashing catalog cache id 14 for pg_opclass; 17 tups, 8 buckets