In v16 and later, the following fails:
CREATE TABLE boom (t character varying(5) DEFAULT 'a long string');
COPY boom FROM STDIN;
ERROR: value too long for type character varying(5)
In PostgreSQL v15 and earlier, the COPY statement succeeds.
The error is thrown in BeginCopyFrom in line 1578 (HEAD)
defexpr = expression_planner(defexpr);
Bisecting shows that the regression was introduced by commit 9f8377f7a2,
which introduced DEFAULT values for COPY FROM.
The table definition is clearly silly, so I am not sure if that
regression is worth fixing. On the other hand, it is not cool if
something that worked without an error in v15 starts to fail later on.
Yours,
Laurenz Albe