Common table expression - parsing questions

From: the6campbells <the6campbells(at)gmail(dot)com>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Common table expression - parsing questions
Date: 2009-09-29 02:54:35
Message-ID: 22431f1b0909281954t21cffc94o291002fe6b545494@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Couple of questions:

1. Why does Postgres not throw a parsing error during sqlPrepare for this
statement vs at sqlExecute

with t_cte ( c1, ctr ) as (
select 1,0 from tversion union
select 2,0 from tversion union all
select c1, ctr + 1 from t_cte where c1=1 and ctr < 5 union all
select c1, ctr + 1 from t_cte where c1=2 and ctr < 5)
select c1, ctr from t_cte

2. Do you intend to remove the requirement to include the recursive keyword
- as other vendors allow

3. Is it a documented restriction that you can only have one reference to
the CTE .. see above example which fails while this modified version works.
The former
works in other vendors.

with recursive t_cte ( c1, ctr ) as (
select 1,0 from tversion union
select 2,0 from tversion union all
select c1, ctr + 1 from t_cte where c1=1 and ctr < 5 )
select c1, ctr from t_cte

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jyoti Seth 2009-09-29 08:52:14 Disable Constraints in Postgresql 8.4
Previous Message Gary Stainburn 2009-09-28 13:43:53 Re: simple (?) join