ORDER BY with LTREE - Mailing list pgsql-sql

From Axel Straschil
Subject ORDER BY with LTREE
Date
Msg-id slrndvbnbs.l6a.axel@m2.sine
Whole thread Raw
Responses Re: ORDER BY with LTREE  (Michael Fuhr <mike@fuhr.org>)
List pgsql-sql
Hello!

Im working with the ltree [1] datatype and have labels that can not used
directly in ltree and a want to get a tree like strukture ordered by the 
labels.

IE, I've got a table

CREATE TABLE t
(tree     LTREE,label    TEXT
);

and data like

tree        label
--------------------------
root.1        z
root.2        c
root.2.1    a
root.2.2    b
root.3        i
root.4        f
root.4.1    k
root.4.2    c

I need a VIEW that ordery by "by tree but by label in the same hirachie", 
so the output should be

root.2        c
root.2.1     a
root.2.2     b
root.4        f
root.4.2     c
root.4.1     k
root.3        i
root.1        z

Any idea?

Thanks, 
AXEL.
[1] http://www.sai.msu.su/~megera/postgres/gist/ltree/



pgsql-sql by date:

Previous
From: Adam Alkins
Date:
Subject: Btrieve to PostgreSQL
Next
From: Greg Stark
Date:
Subject: Re: view of weekly data