Re: Wrote a connect-by feature

From: Bertram Scharpf <lists(at)bertram-scharpf(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Wrote a connect-by feature
Date: 2007-08-08 12:04:23
Message-ID: 20070808120423.GA13412@bart.bertram-scharpf.homelinux.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Am Mittwoch, 08. Aug 2007, 00:52:41 +0200 schrieb Bertram Scharpf:
> <http://www.bertram-scharpf.de/tmp/connectby.tar.gz>

I just extended it. Below an example.

Bertram

--------------------------------

select * from simp;

id | pid | nam
----+-----+----------
1 | | Abe
2 | 1 | Homer
3 | 2 | Bart
4 | 2 | Lisa
5 | 2 | Maggie
6 | | Ned
7 | 6 | Rod
8 | 6 | Todd
9 | | Clancy
10 | 9 | Ralph
11 | | Hyman
12 | 11 | Herschel
(12 rows)

select repeat(' ',t.lev)||(case when t.term then '`' else '|' end)||'-'||s.nam
from connectby_all( 'simp', 'id', 'pid', 'nam asc', null, null)
as t (id integer, pid integer, lev integer, pos integer, term boolean)
join simp as s on (t.id=s.id);

?column?
----------------
|-Abe
`-Homer
|-Bart
|-Lisa
`-Maggie
|-Clancy
`-Ralph
|-Hyman
`-Herschel
`-Ned
|-Rod
`-Todd
(12 rows)

--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavan Deolasee 2007-08-08 12:35:06 GUC for default heap fillfactor
Previous Message Brendan Jurd 2007-08-08 11:36:35 Function structure in formatting.c