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 CBD919DC84B for ; Fri, 17 Feb 2006 10:28:39 -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 46062-05 for ; Fri, 17 Feb 2006 10:28:43 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 9170A9DC808 for ; Fri, 17 Feb 2006 10:28:37 -0400 (AST) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by svr4.postgresql.org (Postfix) with ESMTP id A23D05AF094 for ; Fri, 17 Feb 2006 14:28:42 +0000 (GMT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FA6az-0001VX-15 for pgsql-sql@postgresql.org; Fri, 17 Feb 2006 15:28:29 +0100 Received: from v216-233.vps.tuwien.ac.at ([128.131.216.233]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 17 Feb 2006 15:28:29 +0100 Received: from axel by v216-233.vps.tuwien.ac.at with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 17 Feb 2006 15:28:29 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Axel Straschil Subject: ORDER BY with LTREE Date: Fri, 17 Feb 2006 14:28:13 +0000 (UTC) Lines: 44 Message-ID: Reply-To: axel@straschil.com X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: v216-233.vps.tuwien.ac.at User-Agent: slrn/0.9.8.1 (Linux) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200602/231 X-Sequence-Number: 24241 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/