Re: pl/pgsql uniq varchar[] sort?
От
Merlin Moncure
Тема
Re: pl/pgsql uniq varchar[] sort?
Дата
Msg-id
b42b73150604030810r3716ff33pe20ddc9169267176@mail.gmail.com
Ответ на
pl/pgsql uniq varchar[] sort? (Matthew Peter)
Список
Дерево обсуждения
pl/pgsql uniq varchar[] sort? Matthew Peter <survivedsushi@yahoo.com>
Re: pl/pgsql uniq varchar[] sort? "Merlin Moncure" <mmoncure@gmail.com>
Re: sort a referenced list Matthew Peter <survivedsushi@yahoo.com>
Re: sort a referenced list Tom Lane <tgl@sss.pgh.pa.us>
Re: sort a referenced list Matthew Peter <survivedsushi@yahoo.com>
Re: sort a referenced list Jim Nasby <jnasby@pervasive.com>
On 4/3/06, Matthew Peter wrote: > > Hello list. I'm trying to get a unique, sorted varchar array in pl/pgsql. > Essentially a "group by" and "order by"'d varchar[]. > > Anyone got any ideas or point me in the right direction? Thanks. If your data is not an array type coming off the table but you want it to end up that way, check out array_accum at http://www.postgresql.org/docs/8.1/static/xaggr.html. All you have to do is order the data going into the aggregate: select array_accum(d) from ( select d from t order by... ) if your data is starting off as an array type, you have a few options. you might get the most milage out of a pl/perl procedure to sort the type. If the arrays are small and you absolutely had to do it in plpgsql you could copy the values into a temp table, sort it via query, and resinsert into an array using the above technique. merlin
В списке pgsql-general по дате отправления