I have an integer column
size in my table
product in PostgreSQL 10.5 database. I want to change it's type from
alter table if possible.
The obvious way which worked for me with other types is to execute statement below.
alter table product alter column "size" SET DATA type varchar(20) using size::varchar;
Unfortunately, this way of conversion doesn't work and the error returned:
ERROR: operator does not exist: character varying > integer HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. SQL state: 42883
I tried a bit of googling and searching through StackExchange network, but I haven't found a solution. With this error I'm not sure that creating a new column, transfering data into it will work because I still have to cast information from one column to another.