pgsql: Add some recursion and looping defenses in prepjointree.c.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add some recursion and looping defenses in prepjointree.c.
Date: 2022-12-22 15:35:23
Message-ID: E1p8NbP-004t6c-2K@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add some recursion and looping defenses in prepjointree.c.

Andrey Lepikhov demonstrated a case where we spend an unreasonable
amount of time in pull_up_subqueries(). Not only is that recursing
with no explicit check for stack overrun, but the code seems not
interruptable by control-C. Let's stick a CHECK_FOR_INTERRUPTS
there, along with sprinkling some stack depth checks.

An actual fix for the excessive time consumption seems a bit
risky to back-patch; but this isn't, so let's do so.

Discussion: https://postgr.es/m/703c09a2-08f3-d2ec-b33d-dbecd62428b8@postgrespro.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5beb7881fb27d1830fa4c57ba263c8042449a599

Modified Files
--------------
src/backend/optimizer/prep/prepjointree.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-12-22 15:35:24 pgsql: Add some recursion and looping defenses in prepjointree.c.
Previous Message Justin Pryzby 2022-12-22 15:30:41 Re: pgsql: Remove dead code