Re: [PROPOSAL] Max recursion depth in WITH Queries (Common Table Expressions) - Mailing list pgsql-hackers

From Valery Popov
Subject Re: [PROPOSAL] Max recursion depth in WITH Queries (Common Table Expressions)
Date
Msg-id 5630E28E.6070409@postgrespro.ru
Whole thread Raw
In response to Re: [PROPOSAL] Max recursion depth in WITH Queries (Common Table Expressions)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PROPOSAL] Max recursion depth in WITH Queries (Common Table Expressions)
List pgsql-hackers

28.10.2015 16:33, Tom Lane пишет:
> Valery Popov <v.popov@postgrespro.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




pgsql-hackers by date:

Previous
From: Kouhei Kaigai
Date:
Subject: Re: [DESIGN] ParallelAppend
Next
From: Tom Lane
Date:
Subject: Re: [PROPOSAL] Max recursion depth in WITH Queries (Common Table Expressions)