pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Valery Popov <v.popov@postgrespro.ru>
To: pgsql-hackers@postgresql.org
Subject: Re: [PROPOSAL] Max recursion depth in WITH Queries (Common Table Expressions)
Date: Wed, 28 Oct 2015 17:58:22 +0300
Message-ID: <5630E28E.6070409@postgrespro.ru> (raw)
In-Reply-To: <18351.1446039187@sss.pgh.pa.us>
References: <56307A3F.4050802@postgrespro.ru>
	<18351.1446039187@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (7+ messages)  latest in thread

Message-ID: <5630E28E.6070409@postgrespro.ru>
Permalink:  ../5630E28E.6070409@postgrespro.ru/
Also on:    postgresql.org/message-id/5630E28E.6070409@postgrespro.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: v.popov@postgrespro.ru
  Subject: Re: [PROPOSAL] Max recursion depth in WITH Queries (Common Table Expressions)
  In-Reply-To: <5630E28E.6070409@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox