> I have been studying this a bit more. I don't understand your argument here.
> Why would this query have different semantics than, say
>
> WITH RECURSIVE t(n) AS (
> VALUES (1)
> UNION ALL
> VALUES (2)
> UNION ALL
> SELECT n+1 FROM t WHERE n < 100
> ) SELECT * FROM t LIMI
> On 14. Jan 2022, at 13:21, Peter Eisentraut
> wrote:
>
> There is nothing in there that says that certain branches of the UNION in a
> recursive query mean certain things. In fact, it doesn't even require the
> query to contain a UNION at all. It just says to iterate on evaluating the
>
> On 14. Jan 2022, at 13:21, Peter Eisentraut
wrote:
>
> There is nothing in there that says that certain branches of the
UNION in a recursive query mean certain things. In fact, it doesn't even
require the query to contain a UNION at all. It just says to iterate on
evaluating the query unti
8
16
32
64
128
(8 rows)
This feature deviates only slightly from the current WITH RECURSIVE, and
requires very little changes (~10 loc). Any thoughts on this?
--
Denis Hirn
0001-Allow-multiple-recursive-self-references.patch
Description: Binary data
7;t think any other DBMS has implemented this, except MariaDB. Tested
> here:
There are a few recent DBMSs that I know of that support this: HyPer, Umbra,
DuckDB, and NoisePage.
I'm sure there are some more examples. Still, you are right, many other DBMSs
do not support this – yet.
--
Denis Hirn
Thanks for the feedback, Tom.
> Tom Lane writes:
> [...]
> As far as I can see, the spec flat-out forbids this. In SQL:2021,
> it's discussed in 7.17 syntax rule 3) j) ix), which
> defines [linear recursion]
(Aside: We don't have a copy of the SQL:2021 specification here (all
we've got here is
Based on Toms feedback, and due to the fact that SQL:2021 forbidsnon-linear recursion, version 2 of the patch allows only linearrecursion. Therefore, later SQL committee decisions on non-linearrecursion should not be problematic.> [LIN] PostgreSQL does not allow multiple references to the recursive
Sorry, I didn't append the patch properly.
Best wishes,
--Denis
v2-0001-Allow-multiple-recursive-self-references.patch
Description: Binary data
> This well-formedness check apparently needs to be enhanced to allow for more
> than two branches in the union.
The UNION operators' left associativity causes this problem. Currently, the
recursive term
must be enclosed in parentheses to make this example work:
> WITH RECURSIVE nodes(x) AS (
> I am not sure if this patch should introduce such a rewriting.
I have thought about this again. I think it is reasonable that this patch
introduces
such a rewriting.
> This well-formedness check apparently needs to be enhanced to allow for more
> than two branches in the union.
The new versi
The documentation was not up to date anymore with the most recent changes.
This version of the patch fixes that.
Best,
–– Denis
0008-Allow-multiple-recursive-self-references.patch
Description: Binary data
> I studied up on the theory and terminology being discussed here. I conclude
> that what the latest version of this patch is doing (allowing multiple
> recursive references, but only in a linear-recursion way) is sound and useful.
That's great to hear!
> I haven't looked closely at the implem
> The patch does not apply on Head anymore, could you rebase and post a patch.
Sure thing. Here's the new patch.
Best wishes,
-- Denis
v3-0001-Allow-multiple-recursive-self-references.patch
Description: Binary data
> In the next version of the patch, would you be so kind as to include
> updated documentation of the feature and at least one regression test
> of same?
As requested, this new version of the patch contains regression tests and
documentation.
Best wishes,
-- Denis
0004-Allow-multiple-recurs
> The tests fail when you build with assertions enabled (configure
> --enable-cassert).
Thank you for pointing that out. The new version of this patch fixes that.
The tests are working properly now. All style related issues are fixed as well.
Best wishes,
-- Denis
0005-Allow-multiple-recurs
> Maybe the variable selfrefcountL can be renamed slightly (e.g.
> curr_selfrefcount) so that the code is easier to read.
Yes, you are absolutely right. Thanks for the suggestion.
The new version renames this variable.
Best wishes,
-- Denis
0006-Allow-multiple-recursive-self-references.pat
16 matches
Mail list logo