Similarly, we can SELECT CAST(text '1234' as char(2) DEFAULT '111111' ON conversion ERROR); ERROR: value too long for type character(2)
Both of these are doomed when we hit the default, so I don't see why we should make any accommodation for them.
Composite types respect typmod, for example: CREATE TYPE comp AS (a char(3), b int); SELECT CAST('(14,42)' AS comp DEFAULT '(1234,2)' ON CONVERSION ERROR); -- error
This one is trickier, but I'd be willing to reject composite inputs in v19 and solve it in v20.
The regression tests are too large; we can order them by the cast source type's pg_type.type category, so we won't miss any tests.