agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: pg_plan_advice: Add CHECK_FOR_INTERRUPTS() and check_stack_depth
4+ messages / 3 participants
[nested] [flat]

* pgsql: pg_plan_advice: Add CHECK_FOR_INTERRUPTS() and check_stack_depth
@ 2026-09-09 22:39  Robert Haas <rhaas@postgresql.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Robert Haas @ 2026-09-09 22:39 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_plan_advice: Add CHECK_FOR_INTERRUPTS() and check_stack_depth()

Without CHECK_FOR_INTERRUPTS(), backends might not respond to query
cancellations in a timely fashion, especially for JOIN_ORDER()
specifications, where matching against each join can take O(n^2) time
in the length of the join order list in degenerate cases.

Recursive functions should check_stack_depth().

Reported-by: Noah Misch <noah@leadboat.com>
Discussion: https://postgr.es/m/CA+TgmoYmXy-jiP5qDhqNEiYFEBzQsArO6O2d9E8szNZqi1bePQ@mail.gmail.com
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1129570f654e96d45bbc63397079171af29710b9

Modified Files
--------------
contrib/pg_plan_advice/pgpa_ast.c     | 14 ++++++++++++++
contrib/pg_plan_advice/pgpa_planner.c |  7 +++++++
contrib/pg_plan_advice/pgpa_trove.c   |  3 +++
3 files changed, 24 insertions(+)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: pg_plan_advice: Add CHECK_FOR_INTERRUPTS() and check_stack_depth
@ 2026-09-09 22:39  Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Robert Haas @ 2026-09-09 22:39 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_plan_advice: Add CHECK_FOR_INTERRUPTS() and check_stack_depth()

Without CHECK_FOR_INTERRUPTS(), backends might not respond to query
cancellations in a timely fashion, especially for JOIN_ORDER()
specifications, where matching against each join can take O(n^2) time
in the length of the join order list in degenerate cases.

Recursive functions should check_stack_depth().

Reported-by: Noah Misch <noah@leadboat.com>
Discussion: https://postgr.es/m/CA+TgmoYmXy-jiP5qDhqNEiYFEBzQsArO6O2d9E8szNZqi1bePQ@mail.gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ddee5d03077c05925e83533e50ebe805c934d2cf

Modified Files
--------------
contrib/pg_plan_advice/pgpa_ast.c     | 14 ++++++++++++++
contrib/pg_plan_advice/pgpa_planner.c |  7 +++++++
contrib/pg_plan_advice/pgpa_trove.c   |  3 +++
3 files changed, 24 insertions(+)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: pg_plan_advice: Add CHECK_FOR_INTERRUPTS() and check_stack_depth
@ 2026-09-10 17:41  Nathan Bossart <nathandbossart@gmail.com>
  parent: Robert Haas <rhaas@postgresql.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Nathan Bossart @ 2026-09-10 17:41 UTC (permalink / raw)
  To: Robert Haas <rhaas@postgresql.org>; +Cc: pgsql-committers@lists.postgresql.org

On Wed, Sep 09, 2026 at 10:39:46PM +0000, Robert Haas wrote:
> pg_plan_advice: Add CHECK_FOR_INTERRUPTS() and check_stack_depth()

koel is unhappy with this one:

    https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=koel&dt=2026-09-10%2010%3A34%3A01

-- 
nathan






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: pg_plan_advice: Add CHECK_FOR_INTERRUPTS() and check_stack_depth
@ 2026-09-10 18:12  Robert Haas <robertmhaas@gmail.com>
  parent: Nathan Bossart <nathandbossart@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Robert Haas @ 2026-09-10 18:12 UTC (permalink / raw)
  To: Nathan Bossart <nathandbossart@gmail.com>; +Cc: pgsql-committers@lists.postgresql.org

On Thu, Sep 10, 2026 at 1:41 PM Nathan Bossart <nathandbossart@gmail.com> wrote:
> On Wed, Sep 09, 2026 at 10:39:46PM +0000, Robert Haas wrote:
> > pg_plan_advice: Add CHECK_FOR_INTERRUPTS() and check_stack_depth()
>
> koel is unhappy with this one:
>
>     https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=koel&dt=2026-09-10%2010%3A34%3A01

Yeah, Bilal reported that to me earlier via Discord. Fix pushed now.
(I didn't see this email before pushing it.)

-- 
Robert Haas
EDB: http://www.enterprisedb.com






^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2026-09-10 18:12 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-09 22:39 pgsql: pg_plan_advice: Add CHECK_FOR_INTERRUPTS() and check_stack_depth Robert Haas <rhaas@postgresql.org>
2026-09-10 17:41 ` Nathan Bossart <nathandbossart@gmail.com>
2026-09-10 18:12   ` Robert Haas <robertmhaas@gmail.com>
2026-09-09 22:39 pgsql: pg_plan_advice: Add CHECK_FOR_INTERRUPTS() and check_stack_depth Robert Haas <rhaas@postgresql.org>

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