I have a table in postgresql. The following table \"animals\" will do to explain my problem:
name
------
tiger
cat
dog
Now I am using the follo
This will be available in PostgreSQL 9.0:
http://www.postgresql.org/docs/9.0/static/release-9-0.html, Section E.1.3.6.1. Aggregates
In the meantime, you could do something like this which may solve the problem (albeit clunky):
SELECT array_agg(animal_name)
FROM (
SELECT "name" AS animal_name
FROM animals
ORDER BY "name"
) AS sorted_animals;