Hi jian,

Thanks for v3. It passes my 0002 test, so I will drop 0002 and leave
2 to your patch. 0001 and 0003 still apply on top of v3, and the
tests pass.

v3 also fixes a wrong result that 18 and 19 have:

  create table p (b int, constraint c check (b > 0) not enforced);
  create table k (b int);
  insert into k values (-1);
  alter table k add constraint c check (b > 0) not valid;
  alter table k inherit p;
  alter table p alter column b type bigint;
  select count(*) from p where b < 0;

This returns 0. The ALTER TYPE marks the child's NOT VALID constraint
as validated, so the planner skips k. The one line change in
MergeWithExistingConstraint() from Nikolay's patch [1] fixes it on 18
and 19.

In your p3 example only convalidated changes after a restore, not
conislocal. I think this is your Bug A. I would leave it out of this set.

Bug B reproduces on 18 and later. It is about NOT NULL, so maybe it
needs its own thread.

[1]
https://postgr.es/m/cam527d8qch4q1xv-tftdmm3ebcbie9axfdttthpuogwnyt0...@mail.gmail.com

Thanks,
Shihao

Reply via email to