Thread: right join with partitioned table crash

right join with partitioned table crash

From
Jaime Casanova
Date:
Hi everyone,

Here's another crash caught by sqlsmith.

"""
drop table if exists fkpart3_pk5 cascade;
drop table if exists inet_tbl;

create table fkpart3_pk5 (
    a integer not null primary key
)
partition by range (a);

create table fkpart3_pk51 partition of fkpart3_pk5
    for values from (4000) to (4500);

create table inet_tbl (
    c cidr,
    i inet
);

select
    1 as c0
from
    (select null::integer as c9,
            ref_0.a as c24
       from fkpart3_pk5 as ref_0
          ) as subq_0
          right join public.inet_tbl as sample_0 on (cast(null as cidr) = c)
where subq_0.c9 <= subq_0.c24
"""


Attached the backtrace.

-- 
Jaime Casanova
Director de Servicios Profesionales
SystemGuards - Consultores de PostgreSQL

Attachment

Re: right join with partitioned table crash

From
Tom Lane
Date:
Jaime Casanova <jcasanov@systemguards.com.ec> writes:
> Here's another crash caught by sqlsmith.

Fun.  Looks like it fails back to v12, but not in v11,
so it's some optimization we added in v12 that's at fault.

(That being the case, this isn't a blocker for 14rc1,
though of course it'd be nice if we fix it in time for that.)

            regards, tom lane



Re: right join with partitioned table crash

From
Tom Lane
Date:
Justin Pryzby <pryzby@telsasoft.com> writes:
> On Wed, Sep 15, 2021 at 07:53:49PM -0400, Tom Lane wrote:
>> Jaime Casanova <jcasanov@systemguards.com.ec> writes:
>>> Here's another crash caught by sqlsmith.

>> Fun.  Looks like it fails back to v12, but not in v11,
>> so it's some optimization we added in v12 that's at fault.

> It seems to be a regression (?) in 12.6 (2021-02-11), from
> | 1cce024fd2 Fix pull_varnos' miscomputation of relids set for a PlaceHolderVar.

Yeah, that patch still had a hole in it.  Fix pushed,
thanks for the report!

            regards, tom lane