Re: Wrote a connect-by feature - Mailing list pgsql-hackers

From Bertram Scharpf
Subject Re: Wrote a connect-by feature
Date
Msg-id 20070808120423.GA13412@bart.bertram-scharpf.homelinux.com
Whole thread Raw
In response to Wrote a connect-by feature  (Bertram Scharpf <lists@bertram-scharpf.de>)
Responses Re: Wrote a connect-by feature  (Bertram Scharpf <lists@bertram-scharpf.de>)
List 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 |     | Clancy10 |   9 | Ralph11 |     | Hyman12 |  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
ass 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


pgsql-hackers by date:

Previous
From: "Brendan Jurd"
Date:
Subject: Function structure in formatting.c
Next
From: "Pavan Deolasee"
Date:
Subject: GUC for default heap fillfactor