Re: Bug: Missing check_stack_depth() in GRAPH_TABLE rewriter - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: Bug: Missing check_stack_depth() in GRAPH_TABLE rewriter
Date
Msg-id CAExHW5tywW_yYxXnrpwpCmG-K4QQbyVjqXyNuuwydTcV9VHE8A@mail.gmail.com
Whole thread
In response to Re: Bug: Missing check_stack_depth() in GRAPH_TABLE rewriter  (Peter Eisentraut <peter@eisentraut.org>)
List pgsql-hackers
On Fri, Apr 24, 2026 at 11:54 AM Peter Eisentraut <peter@eisentraut.org> wrote:
>
> On 15.04.26 17:07, Ashutosh Bapat wrote:
> > Thanks for the report. I could reproduce the segfault on my laptop.
> > The attached patch fixes it and gives ERROR:  stack depth limit
> > exceeded.
> >
> > generate_queries_for_path_pattern_recurse() - has to work in a linear
> > fashion since the elements need to be processed in an order. Each
> > permutation of elements produces one query. These queries can be
> > arranged in a balanced tree as you  suggest OR when constructing the
> > setop tree we could generate it in divide-and-conquer manner. However,
> > the tree will be flattened in the planner anyway (See
> > flatten_simple_union_all() and pull_up_simple_union_all()). Thus the
> > final planning will require a deeper stack anyway. The code complexity
> > doesn't seem to be worth it.
> >
> > I also looked at a few commits that add check_stack_depth() to see if
> > we add tests for these scenarios. But I didn't find any. So no tests
> > added with this commit.
>
> committed
>

Thanks a lot for committing this and other fixes.

> (I moved the #include "miscadmin.h" to a more alphabetical position.)
>

Didn't notice this. Sorry.

--
Best Wishes,
Ashutosh Bapat



pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: StringInfo fixes, v19 edition. Plus a few oddities
Next
From: Dilip Kumar
Date:
Subject: Re: Proposal: Conflict log history table for Logical Replication