Re: [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: Re: [PROPOSAL] Max recursion depth in WITH Queries (Common Table Expressions)
Date: 2015-10-28 14:58:22
Message-ID: 5630E28E.6070409@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

28.10.2015 16:33, Tom Lane пишет:
> Valery Popov <v(dot)popov(at)postgrespro(dot)ru> writes:
>> 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.
> The standard way of dealing with that is to include logic in the query to
> limit the recursion depth, for example
>
> WITH RECURSIVE t(n) AS (
> SELECT 1
> UNION ALL
> SELECT n+1 FROM t WHERE n < 10
> )
> SELECT n FROM t;
>
Yes, I agree with this thesis. But I think in some cases would be
better to receive error message and stop execution than results will
incomplete.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-10-28 15:07:34 Re: [PROPOSAL] Max recursion depth in WITH Queries (Common Table Expressions)
Previous Message Kouhei Kaigai 2015-10-28 14:55:00 Re: [DESIGN] ParallelAppend