[PROPOSAL] Max recursion depth in WITH Queries (Common Table Expressions)

From: Valery Popov <v(dot)popov(at)postgrespro(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PROPOSAL] Max recursion depth in WITH Queries (Common Table Expressions)
Date: 2015-10-28 07:33:19
Message-ID: 56307A3F.4050802@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, Hackers

Recursive queries are typically used to deal with hierarchical or
tree-structured data.
In some conditions when data contain relationships with cycles recursive query will loop
unlimited and significantly slows the client's session.
To prevent "infinite" loop I suggest the max_recursion_depth parameter,
which defines the maximum recursion level during the execution of recursive
query.
When max_recursion_depth > 0 and the recursion level of query exceeds
specified value then the execution of query interrupts with error message.
In the MS SQL Server there is MAXRECURSION hint for the same purpose.

Thanks!
--

Regards,
Valery Popov
Postgres Professional http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
recurs_depth_v0.patch text/plain 10.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Voronin 2015-10-28 07:44:37 pg_dump
Previous Message rajan 2015-10-28 07:05:10 Re: Disabling START TRANSACTION for a SuperUser