postgres change data type of view column from unknown to text
If you want to change the data type of a view's columns, you have to drop it, then create it.
CREATE OR REPLACE VIEW .... The new query must generate the same columns that were generated by the existing view query (that is, the same column names in the same order and with the same data types), but it may add additional columns to the end of the list.
Emphasis added.