How to alter a column's data type in a PostgreSQL table?
-
09-01-2021 - |
Question
Entering the following command into a PostgreSQL interactive terminal results in an error:
ALTER TABLE tbl_name ALTER COLUMN col_name varchar (11);
What is the correct command to alter the data type of a column?
La solution
See documentation here: http://www.postgresql.org/docs/current/interactive/sql-altertable.html
ALTER TABLE tbl_name ALTER COLUMN col_name TYPE varchar (11);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow