X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B9D069DC84A for ; Mon, 20 Feb 2006 03:41:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26654-03 for ; Mon, 20 Feb 2006 03:41:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 8B7BF9DC878 for ; Mon, 20 Feb 2006 03:41:27 -0400 (AST) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id k1K7fPoV064646 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 20 Feb 2006 00:41:27 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id k1K7fOww031818; Mon, 20 Feb 2006 00:41:24 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id k1K7fKnd031817; Mon, 20 Feb 2006 00:41:20 -0700 (MST) (envelope-from mfuhr) Date: Mon, 20 Feb 2006 00:41:20 -0700 From: Michael Fuhr To: Axel Straschil Cc: pgsql-sql@postgresql.org Subject: Re: ORDER BY with LTREE Message-ID: <20060220074120.GA31596@winnie.fuhr.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.122 required=5 tests=[AWL=0.122] X-Spam-Score: 0.122 X-Spam-Level: X-Archive-Number: 200602/245 X-Sequence-Number: 24255 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