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

From Tom Lane
Subject Re: [PROPOSAL] Max recursion depth in WITH Queries (Common Table Expressions)
Date
Msg-id 21358.1446044854@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PROPOSAL] Max recursion depth in WITH Queries (Common Table Expressions)  (Valery Popov <v.popov@postgrespro.ru>)
List pgsql-hackers
Valery Popov <v.popov@postgrespro.ru> writes:
> 28.10.2015 16:33, Tom Lane �����:
>> The standard way of dealing with that is to include logic in the query to
>> limit the recursion depth, for example ...

> 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.

Sure, but you can do that at the SQL level if you have a mind to, as well.

In practice, I think people tend to use recursive queries mainly for data
layouts where the maximum recursion depth isn't terribly clear, so that
setting this GUC to a useful value would be a difficult task anyway.
If you end up setting it to 100X or 1000X more than you think your queries
could possibly recurse, you might as well use some other approach like
statement_timeout, which has got a closer relationship to what you care
about, ie how long you want to wait.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Valery Popov
Date:
Subject: Re: [PROPOSAL] Max recursion depth in WITH Queries (Common Table Expressions)
Next
From: Tom Lane
Date:
Subject: Re: Add EXTRA_CFLAGS to configure