How to access array element in pgsql after array_agg - Mailing list pgsql-general

From Condor
Subject How to access array element in pgsql after array_agg
Date
Msg-id 5bc9c7090f9638f9ca98f36d43472bbb@stz-bg.com
Whole thread Raw
Responses Re: How to access array element in pgsql after array_agg
List pgsql-general
Hello,

I wanna ask how I can access array element in array_agg ?

I do select array_agg(ids) from x;
in ids I have int and result is :

        array_agg
       -------------
     {3843,2,3543,33}

I want to access one element or first one direct in sql query like:

select array_agg(ids)[1] from x;

and to receive int value 2

Any hints how I can do it ?

And also for performance did that is good I to do it in SQL or I should
do it in language that I use ? The result in query will return about 2,
3 million rows.


Thank you,

Cheers,
Hristo S.


pgsql-general by date:

Previous
From: Khangelani Gama
Date:
Subject: Re: pg_restore: custom archiver unexpected end of file , ERROR: missing data for column
Next
From: François Beausoleil
Date:
Subject: Re: How to access array element in pgsql after array_agg