I\'d like to change the column type from an int to a uuid. I am using the following statement
ALTER TABLE tableA ALTER COLUMN colA
I was able to convert a column with an INT type, configured as an incrementing primary key using the SERIAL shorthand, using the following process:
-- Ensure the UUID extension is installed.
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- Dropping and recreating the default column value is required because
-- the default INT value is not compatible with the new column type.
ALTER TABLE table_to_alter ALTER COLUMN table_id DROP DEFAULT,
ALTER COLUMN table_id SET DATA TYPE UUID USING (uuid_generate_v4()),
ALTER COLUMN table_id SET DEFAULT uuid_generate_v4();