Lists: | pgsql-hackers |
---|
From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | recursive view syntax |
Date: | 2012-11-14 04:32:15 |
Message-ID: | 1352867535.26167.8.camel@vanquo.pezone.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
I noticed we don't implement the recursive view syntax, even though it's
part of the standard SQL feature set for recursive queries. Here is a
patch to add that. It basically converts
CREATE RECURSIVE VIEW name (columns) AS SELECT ...;
to
CREATE VIEW name AS WITH RECURSIVE name (columns) AS (SELECT ...) SELECT
columns FROM name;
Attachment | Content-Type | Size |
---|---|---|
pg-recursive-view.patch | text/x-patch | 6.1 KB |
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: recursive view syntax |
Date: | 2012-11-14 04:44:21 |
Message-ID: | 8384.1352868261@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> I noticed we don't implement the recursive view syntax, even though it's
> part of the standard SQL feature set for recursive queries. Here is a
> patch to add that.
Can't you simplify that by using "SELECT * FROM name"?
regards, tom lane
From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: recursive view syntax |
Date: | 2012-11-15 03:44:18 |
Message-ID: | 1352951058.26167.10.camel@vanquo.pezone.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, 2012-11-13 at 23:44 -0500, Tom Lane wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> > I noticed we don't implement the recursive view syntax, even though it's
> > part of the standard SQL feature set for recursive queries. Here is a
> > patch to add that.
>
> Can't you simplify that by using "SELECT * FROM name"?
You mean in the expansion?
Maybe, but SELECT * is perhaps something best avoided because of unclear
side effects.
From: | Abhijit Menon-Sen <ams(at)2ndQuadrant(dot)com> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: recursive view syntax |
Date: | 2012-12-13 12:48:14 |
Message-ID: | 20121213124814.GA3920@toroid.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
At 2012-11-13 23:32:15 -0500, peter_e(at)gmx(dot)net wrote:
>
> I noticed we don't implement the recursive view syntax, even though
> it's part of the standard SQL feature set for recursive queries.
> Here is a patch to add that. It basically converts
>
> CREATE RECURSIVE VIEW name (columns) AS SELECT ...;
>
> to
>
> CREATE VIEW name AS WITH RECURSIVE name (columns) AS (SELECT ...)
> SELECT columns FROM name;
Hi.
Sorry I took so long to post a review of this patch. I'm afraid it
tempted me to digress into figuring out how WITH RECURSIVE works. :-)
I don't have much to say about the patch, though: it applies to HEAD and
builds cleanly, passes "make check", and has suitable documentation with
an example. The code looks fine.
I'm marking it ready for committer.
-- Abhijit
From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: recursive view syntax |
Date: | 2013-01-18 15:00:47 |
Message-ID: | 20130118150047.GB16126@tamriel.snowman.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
* Peter Eisentraut (peter_e(at)gmx(dot)net) wrote:
> I noticed we don't implement the recursive view syntax, even though it's
> part of the standard SQL feature set for recursive queries. Here is a
> patch to add that. It basically converts
>
> CREATE RECURSIVE VIEW name (columns) AS SELECT ...;
>
> to
>
> CREATE VIEW name AS WITH RECURSIVE name (columns) AS (SELECT ...) SELECT
> columns FROM name;
I've done another review of this patch and it looks pretty good to me.
My only complaint is that there isn't a single comment inside
makeRecursiveViewSelect().
One other thought is- I'm guessing this isn't going to work:
CREATE RECURSIVE VIEW name (columns) AS WITH ... SELECT ...;
Does the spec explicitly allow or disallow that? Should we provide any
comments about it?
Thanks,
Stephen
From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: recursive view syntax |
Date: | 2013-02-01 03:34:49 |
Message-ID: | 1359689689.29096.3.camel@vanquo.pezone.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Fri, 2013-01-18 at 10:00 -0500, Stephen Frost wrote:
> I've done another review of this patch and it looks pretty good to me.
> My only complaint is that there isn't a single comment inside
> makeRecursiveViewSelect().
Added some of that and committed.
> One other thought is- I'm guessing this isn't going to work:
>
> CREATE RECURSIVE VIEW name (columns) AS WITH ... SELECT ...;
>
> Does the spec explicitly allow or disallow that? Should we provide any
> comments about it?
That works fine, AFAICT. It just becomes another level of WITH.