Re: ORDER BY with LTREE

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Axel Straschil <axel(at)straschil(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: ORDER BY with LTREE
Date: 2006-02-20 07:41:20
Message-ID: 20060220074120.GA31596@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, Feb 17, 2006 at 02:28:13PM +0000, Axel Straschil wrote:
> 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.

Are you saying that you can't convert labels into ltree values like
'c.a' and order by that? What data type are the real labels?

One possibility would be to create a custom operator and add a USING
clause to the ORDER BY clause. The operator could compare records
by whatever algorithm you like, even if that means looking up other
records (e.g., to determine an ancestor's label). That could be
expensive for a large table but it might be worth considering.

--
Michael Fuhr

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Milorad Poluga 2006-02-20 08:39:27 Re: Interval subtracting
Previous Message Michael Fuhr 2006-02-19 19:07:13 Re: Given 02-01-2006 to 02-28-2006, output all days.