Skip site navigation (1) Skip section navigation (2)

Re: [PATCHES] WITH RECUSIVE patches 0723

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: david(at)fetter(dot)org
Cc: ishii(at)postgresql(dot)org, tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org, y-asaba(at)sraoss(dot)co(dot)jp
Subject: Re: [PATCHES] WITH RECUSIVE patches 0723
Date: 2008-07-25 00:26:52
Message-ID: 20080725.092652.105178884.t-ishii@sraoss.co.jp (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
> Now, I get a different problem, this time with the following code
> intended to materialize paths on the fly and summarize down to a
> certain depth in a tree:
> 
> CREATE TABLE tree(
>     id INTEGER PRIMARY KEY,
>     parent_id INTEGER REFERENCES tree(id)
> );
> 
> INSERT INTO tree
> VALUES (1, NULL), (2, 1), (3,1), (4,2), (5,2), (6,2), (7,3), (8,3),
>        (9,4), (10,4), (11,7), (12,7), (13,7), (14, 9), (15,11), (16,11);
> 
> WITH RECURSIVE t(id, path) AS (
>     VALUES(1,ARRAY[NULL::integer])
> UNION ALL
>     SELECT tree.id, t.path || tree.id
>     FROM tree JOIN t ON (tree.parent_id = t.id)
> )
> SELECT
>     t1.id, count(t2.*)
> FROM
>     t t1
> JOIN
>     t t2
> ON (
>     t1.path[1:2] = t2.path[1:2]
> AND
>     array_upper(t1.path,1) = 2
> AND
>     array_upper(t2.path,1) > 2
> )
> GROUP BY t1.id;
> ERROR: unrecognized node type: 203

Thanks for the report. We will look into this.

> Please apply the attached patch to help out with tab
> completion in psql.

Ok, it will appear in the next patches.
--
Tatsuo Ishii
SRA OSS, Inc. Japan

In response to

Responses

pgsql-hackers by date

Next:From: Stephen FrostDate: 2008-07-25 00:46:30
Subject: Re: pg_dump vs data-only dumps vs --disable-triggers
Previous:From: David FetterDate: 2008-07-25 00:15:13
Subject: Re: [PATCHES] WITH RECUSIVE patches 0723

pgsql-patches by date

Next:From: Teodor SigaevDate: 2008-07-25 07:48:24
Subject: Re: [PATCHES] GIN improvements
Previous:From: David FetterDate: 2008-07-25 00:15:13
Subject: Re: [PATCHES] WITH RECUSIVE patches 0723

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group