Hi Haibo,

Thanks for the patch. I reviewed v1 and the main fix looks right to
me.  I think it needs to go back to 18.

On 19 the wrong results go further. Take jian's case as a partitioned
table, and add o(x int not null) with one row. Then

  select count(*) from o where x not in (select a from p);

returns 1 on 19 and 0 on 18. The bug is from 18, so maybe it belongs
under "Older bugs affecting stable branches" on the 19 open items page.

A few notes.
1. I ran the test before and after I believe it catched the bug, but 1k loc
feels too much for me.

2. with your change
create table tp (a int);
create table tc () inherits (tp);
create table tg () inherits (tc);
alter table tg add constraint tg_nn not null a not valid;
alter table tp add constraint tp_nn not null a no inherit* not valid;*
alter table tp alter constraint tp_nn inherit;
-- ERROR:  incompatible NOT VALID constraint "tg_nn" on relation "tg"

INHERIT adds tp_nn to tc as a valid constraint, and then tg is
rejected. Since tp_nn is NOT VALID, maybe the copy on tc should be
NOT VALID too. ADD CONSTRAINT ... NOT VALID works that way.

Thanks,
Shihao

Reply via email to