Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 1776563373B for ; Mon, 28 Sep 2009 23:54:48 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 65397-06 for ; Tue, 29 Sep 2009 02:54:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-vw0-f181.google.com (mail-vw0-f181.google.com [209.85.212.181]) by mail.postgresql.org (Postfix) with ESMTP id 31E45633589 for ; Mon, 28 Sep 2009 23:54:37 -0300 (ADT) Received: by vws11 with SMTP id 11so1031785vws.28 for ; Mon, 28 Sep 2009 19:54:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=it8Ix+c1GOhzqWfYygB42jGuxHxONzgtTF77wpPYoqQ=; b=d3gmNRpXFgbpAi5KGb4YZbMW3Um5aKLabJqll5k9IamRDzEKFrs9JYnQq2gpxmicTe t82badHxE5piFFNdTNA2YiKlrYry2gTw7aLk8lqbY7nBmBxdA1+DKCfoKHnjldIoNsq8 fuzKI9Gq9c1kk0usLh2MI6LXFrYn8xM2SzaJA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=hrWfcei/+mbsXlBuE9ynIJYZl0y3RbGU1tuKzmjAi8QX3sto1l3Rt330Pd7ydCLRZx a2VcENlzJbGRb+0YZHcisYQ1tbmX1oUfH393Az4lk09zH/LMTmFSOcmiS1gH+T5XidF9 nYCvFiMAt3v2l0+SarHwXTuMz/q3llvfRinN0= MIME-Version: 1.0 Received: by 10.220.19.199 with SMTP id c7mr6968960vcb.84.1254192875326; Mon, 28 Sep 2009 19:54:35 -0700 (PDT) Date: Mon, 28 Sep 2009 22:54:35 -0400 Message-ID: <22431f1b0909281954t21cffc94o291002fe6b545494@mail.gmail.com> Subject: Common table expression - parsing questions From: the6campbells To: "pgsql-sql@postgresql.org" Content-Type: multipart/alternative; boundary=00163646da3ad04f550474ae884d X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.739 tagged_above=-10 required=5 tests=BAYES_20=-0.74, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200910/15 X-Sequence-Number: 33214 --00163646da3ad04f550474ae884d Content-Type: text/plain; charset=ISO-8859-1 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 --00163646da3ad04f550474ae884d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Couple of questions:
=A0
1. Why does Postgres not throw a parsi= ng error=20 during sqlPrepare for this statement vs at sqlExecute
=A0
with t_cte ( c1, ctr ) as (
select= 1,0 from=20 tversion union
select 2,0 from tversion union all
select c1, ctr + = 1=20 from t_cte where c1=3D1 and ctr < 5 union all
select c1, ctr + 1 fro= m t_cte=20 where c1=3D2 and ctr < 5)
select c1, ctr from t_cte
=A0
2. Do you intend to remove the require= ment to include the recursive keyword - as other vendors allow
=

3. Is it a documented restriction that you can only hav= e one reference to the CTE .. see above example which fails while this modi= fied version works. The former
works in other vendors.
=A0
with recursive t_cte ( c1, ctr ) as ( =
select=20 1,0 from tversion union
select 2,0 from tversion union all
select c= 1,=20 ctr + 1 from t_cte where c1=3D1 and ctr < 5 )
select c1, ctr from=20 t_cte
--00163646da3ad04f550474ae884d--