pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Axel Straschil <axel@straschil.com>
To: pgsql-sql@postgresql.org
Subject: ORDER BY with LTREE
Date: Fri, 17 Feb 2006 14:28:13 +0000 (UTC)
Message-ID: <slrndvbnbs.l6a.axel@m2.sine> (raw)

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/




view thread (4+ messages)  latest in thread

Message-ID: <slrndvbnbs.l6a.axel@m2.sine>
Permalink:  ../slrndvbnbs.l6a.axel@m2.sine/
Also on:    postgresql.org/message-id/slrndvbnbs.l6a.axel@m2.sine

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: axel@straschil.com
  Subject: Re: ORDER BY with LTREE
  In-Reply-To: <slrndvbnbs.l6a.axel@m2.sine>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox