Re:Postgres: Boundless `Text` and Back Again
by pphysch on Friday September 10, 2021 @06:28PM
(#28487609)
This approach makes a lot more sense. The real problem here is input validation, not type mismatch.
Arguably, this could extend to real numerical data (use NUMERIC everywhere as a default), but the performance impacts of that are far more severe.
To cope with this, in the same transaction that you're increasing the length of the varchar, you will also need to drop and recreate all such dependent views (and any other views that depend upon those views, etc).
This is not fun.
In comparison: increase the maximum length of the check constraint, job done.