Change column type of PostegreSQL Database

1

I need to change the column type of a table

I'm using the following code:

ALTER TABLE cadastro_remetente ALTER COLUMN ssl_smtp DROP DEFAULT;

ALTER TABLE cadastro_remetente ALTER COLUMN ssl_smtp SET DEFAULT FALSE;

ALTER TABLE cadastro_remetente ALTER ssl_smtp TYPE bool USING CASE WHEN ssl_smtp='TRUE' THEN TRUE ELSE FALSE END;'

smtp is currently character varying

I'm returning the following error:

  

ERROR: check constraint "ssl_smtp" was violated by some registry

     

********** Error **********

     

ERROR: verification restriction "ssl_smtp" was violated by some registry   SQL state: 23514

All logs are either TRUE or FALSE

Can anyone help me with this?

    
asked by anonymous 12.01.2016 / 15:14

1 answer

1

ALTER TABLE register_remove   ADD COLUMN "ssl_smtp" BOOLEAN NOT NULL DEFAULT FALSE;

    
12.01.2016 / 15:30