Postgres Alter table to convert column type from char to bigint [duplicate]

To convert simply by parsing the string (casting):

alter table the_table alter column the_column type bigint using the_column::bigint

In fact, you can use any expression in terms of the_column instead of the_column::bigint to customise the conversion.

Note this will rewrite the table, locking out even readers until it’s done.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)