Re: Ltree - how to sort nodes on parent node

From: Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
To: xcojack(at)gmail(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Ltree - how to sort nodes on parent node
Date: 2010-04-19 18:04:02
Message-ID: BB80D221-44CC-4174-9576-5032C0FF398F@solfertje.student.utwente.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 19 Apr 2010, at 9:23, cojack wrote:

> Hello,

> id | path | sort
> ----+-----------------------------------------------+------
> 1 | Top | 1
> 2 | Top.Science | 1
> 3 | Top.Science.Astronomy | 1
> 4 | Top.Science.Astronomy.Astrophysics | 1
> 5 | Top.Science.Astronomy.Cosmology | 2
> 6 | Top.Hobbies | 2
> 7 | Top.Hobbies.Amateurs_Astronomy | 2
> 8 | Top.Collections | 3
> 9 | Top.Collections.Pictures | 1
> 10 | Top.Collections.Pictures.Astronomy | 1
> 11 | Top.Collections.Pictures.Astronomy.Stars | 1
> 12 | Top.Collections.Pictures.Astronomy.Galaxies | 2
> 13 | Top.Collections.Pictures.Astronomy.Astronauts | 3
> 15 | Top.Science.Programing | 3

It would help if you'd show us what result you expect from ordering the above.

Most people would order this by path I think. However that doesn't match your sort column and I can't think of any method that would give results in such an arbitrary order as you seem to be specifying - unless you set it by hand like you do.

Alban Hertroys

--
Screwing up is an excellent way to attach something to the ceiling.

!DSPAM:737,4bcc9b1e10415135793547!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message cojack 2010-04-19 18:26:59 Re: Ltree - how to sort nodes on parent node
Previous Message Tom Lane 2010-04-19 17:32:26 Re: Database corruption with duplicate tables.