I applied the domain.patch from above on HEAD, and all I get is cache lookup failures. The type_sanity regression test fails too.
postgres=# CREATE DOMAIN teenager AS int CHECK (VALUE BETWEEN 13 AND 20); CREATE DOMAIN postgres=# CREATE DOMAIN teenager_groups AS teenager[]; CREATE DOMAIN postgres=# CREATE TABLE x (col teenager_groups); ERROR: cache lookup failed for type 0
Anyway, if that worked for me I would have done this which I expect will succeed when it shouldn't.
INSERT INTO x VALUES (ARRAY[13,14,20]); ALTER DOMAIN teenager DROP CONSTRAINT teenager_check; ALTER DOMAIN teenager ADD CHECK (VALUE BETWEEN 13 AND 19);