pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: the6campbells <the6campbells@gmail.com>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Common table expression - parsing questions
Date: Mon, 28 Sep 2009 22:54:35 -0400
Message-ID: <22431f1b0909281954t21cffc94o291002fe6b545494@mail.gmail.com> (raw)

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

view thread (5+ messages)  latest in thread

Message-ID: <22431f1b0909281954t21cffc94o291002fe6b545494@mail.gmail.com>
Permalink:  ../22431f1b0909281954t21cffc94o291002fe6b545494@mail.gmail.com/
Also on:    postgresql.org/message-id/22431f1b0909281954t21cffc94o291002fe6b545494@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: the6campbells@gmail.com
  Subject: Re: Common table expression - parsing questions
  In-Reply-To: <22431f1b0909281954t21cffc94o291002fe6b545494@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox