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 <survivedsushi@yahoo.com>)
Ответы Re: sort a referenced list  (Matthew Peter <survivedsushi@yahoo.com>)
Список pgsql-general
On 4/3/06, Matthew Peter <survivedsushi@yahoo.com> 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 по дате отправления:

Предыдущее
От: "William Leite Araújo"
Дата:
Сообщение: Re: How to delete all operators
Следующее
От: Richard Broersma Jr
Дата:
Сообщение: Re: database design questions