While transforming the LIKE clause in transformTableLikeClause(), the
function does remap the varattnos of the constraint expression.
838│
839│ ccbin_node =
map_variable_attnos(stringToNode(ccbin),
840│
1, 0,
841│
attmap, tupleDesc->natts,
842│
&found_whole_row);
So,
It seems CREATE TABLE ... (LIKE INCLUDING CONSTRAINTS) doesn't work
cleanly when there's also regular inheritance; my guess is that attnums
get messed up at some point after the constraints are generated.
Here's a trivial test case:
create table b (b1 int unique check (b1 > 100));
CREATE TABLE c