PG Bug reporting form <noreply@postgresql.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