> RemoveConstraintById() should think recurse(e.g. partition table)? I'm not > sure now. > If we should think process recurse in RemoveConstraintById(), the > function will look complicated than before.
No -- this function handles just a single constraint, as identified by OID. The recursion is handled by upper layers, which can be either dependency.c or tablecmds.c. I think the problem you found is caused by the fact that I worked with the tablecmds.c recursion and neglected the one in dependency.c.
Indeed.
create table skip_wal_skip_rewrite_index (c varchar(10) primary key); alter table skip_wal_skip_rewrite_index alter c type varchar(20);
Above SQL need attnotnull to be true when re-add index, but RemoveConstraintById() is hard to recognize this scenario as I know.
We should re-set attnotnull to be true before re-add index. I add a new AT_PASS in attached patch.