I tried to alter a column to integer type using the below query postgres.
alter table pm_user alter column testing2 type integer using testing2::integer;
pm_user - table name
testing2 - column name
The above column would be any kind of data type eg: boolean, text, varchar(256).
It gives error as 'ERROR: invalid input syntax for integer: "NULL"' I tried solutions as below based on the previous queries asked in this website but it is not working for me.
alter table pm_user alter column testing2 type integer using (testing2::integer);
alter table pm_user alter column testing2 type integer;
alter table pm_user alter column testing2 type numeric using (testing2::numeric);
alter table pm_user alter column testing2 type numeric (10,2);
What is the actual problem? Where it points input as null? which one is taken as null? What solution I can provide. The same query works when I try to change as
alter table pm_user alter column testing2 type text using testing2::text;
alter table pm_user alter column testing2 type varchar(256)using testing2::varchar(256);
It is also not working for boolean.