Based on Toms feedback, and due to the fact that SQL:2021 forbids
non-linear recursion, version 2 of the patch allows only linear
recursion. Therefore, later SQL committee decisions on non-linear
recursion should not be problematic.

> [LIN] PostgreSQL does not allow multiple references to the recursive
> common table, even if the recursion is LINEAR. Plenty of examples
> of such queries are found in the documentation of established RDBMSs,
> among these IBM Db2 and MS SQL Server:
>
> (example "Two tables used for recursion using recursive common
> table expressions")

See the gist at [1] below for SQL code that features multiple (yet linear)
recursive references. A patched PostgreSQL runs this query as expected.

Best wishes,
--Denis and Torsten


Attachment: 0002-Allow-multiple-recursive-self-references.patch
Description: Binary data


Reply via email to