From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Richard Huxton <dev(at)archonet(dot)com> |
Cc: | "FERREIRA William (COFRAMI)" <william(dot)ferreira(at)airbus(dot)com>, "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: rows and array |
Date: | 2005-02-22 15:29:13 |
Message-ID: | 9645.1109086153@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Richard Huxton <dev(at)archonet(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Maldonado | 2005-02-22 15:38:55 | vacuuming slow |
Previous Message | Tom Lane | 2005-02-22 15:23:39 | Re: migration |