Re: rows and array

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: rows and array
Дата
Msg-id 9645.1109086153@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: rows and array  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
Richard Huxton <dev@archonet.com> writes:
> FERREIRA William (COFRAMI) wrote:
>> i can store rows and re-order them like this :
>> children(i-j) := children(i-j-1);

> Well, I'd look at one of three solutions:
>   1. Functional index to order by
>   2. Temporary table (read up on EXECUTE and OID caching)
>   3. pl/perl/python (which are better suited to this sort of thing)

I think what he's saying is he wants to do the re-ordering on the client
side.  This seems trivial enough.  If I were doing it against a libpq
result set, I'd probably not bother to sort the physical rows; I'd just
make an array of integers representing row numbers in the PGresult and
sort the row numbers, then use those numbers to pull out the fields when
it came time to display 'em.  (Another way to say that is that a
PGresult *is* an array, it's just got a funny access syntax.)

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: migration
Следующее
От: Joe Maldonado
Дата:
Сообщение: vacuuming slow