Reputation: 1014
When using array_agg or array_string, the array returns empty above a certain size.
SELECT array_agg(x.id) FROM (SELECT id FROM table LIMIT 500) x
- this works and returns an array.
but this query : SELECT array_agg(x.id) FROM (SELECT id FROM table LIMIT 667) x
Doesn't work. it returns an empty array.
i'm pretty sure this doesn't reach the limitation size of an array. Any ideas why is this happening?
Upvotes: 6
Views: 3559
Reputation: 1014
the issue here was not Postgresql, but rather the client I was using.
pgAdmin III
doesn't display the content of array over a certain size. about 4.5k.
when using psql
one doesn't encounter the same issue.
the the UI of pgAdmin
there is an option to set "Max characters per column" and it was set to 256 in my case, which makes little sense.
but you copy & paste the array that looks empty into notepad you'll find the all the data is there.
Upvotes: 5