Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZrSBN-0000wd-R3 for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Oct 2015 14:58:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZrSBN-0005gc-DB for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Oct 2015 14:58:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZrSBM-0005gW-Kv for pgsql-hackers@postgresql.org; Wed, 28 Oct 2015 14:58:32 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZrSBD-0005oU-L6 for pgsql-hackers@postgresql.org; Wed, 28 Oct 2015 14:58:32 +0000 Received: from [192.168.27.123] (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id F39B021C4194 for ; Wed, 28 Oct 2015 17:58:22 +0300 (MSK) Subject: Re: [PROPOSAL] Max recursion depth in WITH Queries (Common Table Expressions) To: pgsql-hackers@postgresql.org References: <56307A3F.4050802@postgrespro.ru> <18351.1446039187@sss.pgh.pa.us> From: Valery Popov Message-ID: <5630E28E.6070409@postgrespro.ru> Date: Wed, 28 Oct 2015 17:58:22 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <18351.1446039187@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 28.10.2015 16:33, Tom Lane пишет: > Valery Popov 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