Re: BUG #18360: Invalid memory access occurs when using geqo

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: exclusion(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18360: Invalid memory access occurs when using geqo
Date: 2024-02-23 17:45:39
Message-ID: 831847.1708710339@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> The following script:
> SET enable_partitionwise_join = on;
> SET geqo_threshold = 2;

> CREATE TABLE t (i int) PARTITION BY LIST (i);
> CREATE TABLE tp1 PARTITION OF t FOR VALUES IN (1);
> SELECT t1.* FROM t t1 WHERE EXISTS (SELECT 1 FROM t t2 WHERE t1.i = t2.i);

> leads to a server crash with the following stack trace:

Yup, reproduces here.

> It looks like uniq_exprs points to memory located in a short-lived context
> created in geqo_eval().

Indeed. Curiously, the in_operators list, which I thought was
parallel to that, seems fine. Anyway, something's being careless
about which context it creates that data structure in. Shouldn't
be too hard to fix.

I wonder whether we need a debugging mode that frees path detritus
under the same rules as GEQO does, even for single-relation queries.
This sort of problem can escape notice for a long time.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-02-23 19:33:49 Re: BUG #18360: Invalid memory access occurs when using geqo
Previous Message PG Bug reporting form 2024-02-23 13:00:01 BUG #18360: Invalid memory access occurs when using geqo