From: | luis(dot)roberto(at)siscobra(dot)com(dot)br |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>, "alan(dot)formagi" <alan(dot)formagi(at)siscobra(dot)com(dot)br> |
Subject: | Re: segfault with incremental sort |
Date: | 2020-11-03 12:37:33 |
Message-ID: | 1779929796.39206557.1604407053112.JavaMail.zimbra@siscobra.com.br |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hm ... suggestive, but not really enough to debug it.
Can you build a self-contained test case?
regards, tom lane
Hi Tom!
It took me some time to make it the same... I managed to simplify the error. It appears to be something related to a subplan with a distinct clause and another subplan...
drop table main,secondary;
create table main (
id bigint generated by default as identity primary key,
id2 int not null,
type smallint default 0,
name text not null
);
insert into main (id2,name,type)
select (id%100)+1,md5(id::text),case when (id%100) > 0 then 0 else 1 end
from generate_series(1,3401305) a(id);
create index on main (id2);
create table secondary (
id bigint,
id2 smallint,
name text,
primary key (id,id2)
);
insert into secondary (id,id2,name)
select m.id,a.seq,md5(m.id::text)
from main m,
generate_series(1,16) a(seq);
analyze main,secondary;
explain analyze
select m.id2,
m.id,
s.description
FROM main m
LEFT JOIN ( SELECT DISTINCT
m.id,
CASE
WHEN m.id2 = 15 AND (SELECT name FROM secondary x WHERE x.id = s2.id AND x.id2 = 10) = md5(123::text) THEN 'description'
WHEN m.id2 = 15 THEN (SELECT name FROM secondary x WHERE x.id = s2.id AND x.id2 = 5)
END AS description
FROM main m
JOIN secondary s2 ON m.id = s2.id
WHERE m.id2 = 15
and type = 0) s ON s.id = m.id
WHERE m.id2 IN (15)
and type = 0
From | Date | Subject | |
---|---|---|---|
Next Message | Miha Vrhovnik | 2020-11-03 13:14:05 | Re: BUG #16698: Create extension and search path |
Previous Message | Heikki Linnakangas | 2020-11-03 12:18:47 | Re: BUG #16698: Create extension and search path |