Re: Sorting with materialized paths - Mailing list pgsql-general

From Greg Stark
Subject Re: Sorting with materialized paths
Date
Msg-id i2h407d949e1005101106hf18cbea6wffdd9ce1d73700e9@mail.gmail.com
Whole thread Raw
In response to Re: Sorting with materialized paths  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Sorting with materialized paths  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
List pgsql-general
On Sun, May 9, 2010 at 4:47 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Ovid <curtis_ovid_poe@yahoo.com> writes:
>> My apologies. This isn't PG-specific, but since this is running on PostgreSQL 8.4, maybe there are specific features
whichmight help. 
>> I have a tree structure in a table and it uses materialized paths to allow me to find children quickly. However, I
alsoneed to sort the results depth-first, as one would expect with threaded forum replies. 
>
> I think contrib/ltree might help you here.  However, it seems to sort
> node names textually rather than numerically, so you might need to
> change it a bit for your own purposes.
>

That's rather unfortunate. Ltree is awfully convenient and it would be
nice to be able to use it.

If you just used plain Postgres arrays of integers you would get the
sorting you want. But you lose all the useful ltree operators for
trees.

--
greg

pgsql-general by date:

Previous
From: Peter Hunsberger
Date:
Subject: Re: Sorting with materialized paths
Next
From: "Joshua D. Drake"
Date:
Subject: Re: How to do pg_dump + pg_restore within Perl script?