Re: SQL standard question about Common Table Expressions

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SQL standard question about Common Table Expressions
Date: 2008-09-09 04:45:24
Message-ID: 1220935524.12678.151.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2008-09-09 at 01:45 +0100, Andrew Gierth wrote:
> The "contains" language in the spec is tricky. And I think there's some
> issue here with the spec confusing <query expression> and <query
> expression body>; some of the language refers to "If a <query expression>
> AQEk not marked as recursive is immediately contained in a <query
> expression body>" which is not possible as the syntax production for
> <query expression body> does not contain <query expression>.

Now that you point that out, I think that is a mistake in the spec. Your
version makes a lot more sense.

Thank you for going into the gory details of the algorithm, there were a
few other things tripping me up that you clarified.

I was going crazy yesterday trying to piece together what is supposed to
happen for, e.g., using INTERSECT to connect the recursive and the
non-recursive parts, and this answers it. I'm not suggesting that we
require support for INTERSECT, but my curiosity got the best of me.

Regards,
Jeff Davis

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2008-09-09 04:45:55 Re: Common Table Expressions (WITH RECURSIVE) patch
Previous Message Joshua Drake 2008-09-09 04:19:02 Re: [PATCH] Cleanup of GUC units code