postgresqlpsqlpsqlodbc

PSQL - Modify data type of column


ALTER TABLE user_login ALTER COLUMN dob date;

Is this correct query in psql to modify the data type of the column?


Solution

  • No, you need to include TYPE. It should be

    ALTER TABLE user_login ALTER COLUMN dob TYPE date
    

    See the documentation. You're probably confused with ADD COLUMN where you can omit the TYPE.