You might be thinking of older versions on MySQL. PostgreSQL never had this behavior of silently altering on write. It goes in the database as provided, or it raises an error. Period.
> PostgreSQL never had this behavior of silently altering on write. It goes in the database as provided, or it raises an error. Period.
That is not actually true but the GP might have gotten their wires crossed a bit between MySQL's behaviour of strait truncating and the SQL Standard's behaviour (which postgres implements) of truncating trailing spaces if they go beyond the specified length limit.
So per-spec "xxx" will fail to insert in a varchar(2), but "xx " will succeed returning just "xx" when fetching.
That is not actually true but the GP might have gotten their wires crossed a bit between MySQL's behaviour of strait truncating and the SQL Standard's behaviour (which postgres implements) of truncating trailing spaces if they go beyond the specified length limit.
So per-spec "xxx" will fail to insert in a varchar(2), but "xx " will succeed returning just "xx" when fetching.