Richard Huxton <dev@xxxxxxxxxxxx> 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 ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq