From: | Thomas Kellerer <spam_eater(at)gmx(dot)net> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Combining several CTEs with a recursive CTE |
Date: | 2011-09-20 09:58:20 |
Message-ID: | j59o2m$dn1$1@dough.gmane.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hello all,
this is more a "just curious" question, rather than a real world problem.
We can combine several CTEs into a single select using something like this:
WITH cte_1 as (
select ....
),
cte_2 as (
select ...
where id (select some_col from cte_1)
)
select *
from cte_2;
But this does not seem to work when a recursive CTE is involved
WITH cte_1 as (
select ....
),
recursive cte_2 as (
select ...
where id (select some_col from cte_1)
union all
select ...
)
select *
from cte_2;
This throws an error: syntax error at or near "cte_2"
I'm just wondering if this is intended behavioury, simply not (yet) implemented or even invalid according to the standard? I didn't find any reference that it's not allowed in the manual.
Regards
Thomas
From | Date | Subject | |
---|---|---|---|
Next Message | David Johnston | 2011-09-20 14:15:01 | Re: Combining several CTEs with a recursive CTE |
Previous Message | Dianna Harter | 2011-09-19 21:31:57 | Re: Window function sort order help |