@ -1673,7 +1673,8 @@ select f3,max(f1) from foo group by f3;
-- Simple tests for alter table column type
alter table foo alter f1 TYPE integer; -- fails
ERROR: column "f1" cannot be cast to type integer
ERROR: column "f1" cannot be cast automatically to type integer
HINT: Specify a USING expression to perform the conversion.
alter table foo alter f1 TYPE varchar(10);
create table anothertab (atcol1 serial8, atcol2 boolean,
constraint anothertab_chk check (atcol1 <= 3));
@ -1688,7 +1689,8 @@ select * from anothertab;
(2 rows)
alter table anothertab alter column atcol1 type boolean; -- fails
ERROR: column "atcol1" cannot be cast to type boolean
ERROR: column "atcol1" cannot be cast automatically to type boolean
HINT: Specify a USING expression to perform the conversion.
alter table anothertab alter column atcol1 type integer;
select * from anothertab;
atcol1 | atcol2
@ -1723,7 +1725,7 @@ select * from anothertab;
alter table anothertab alter column atcol1 type boolean
using case when atcol1 % 2 = 0 then true else false end; -- fails
ERROR: default for column "atcol1" cannot be cast to type boolean
ERROR: default for column "atcol1" cannot be cast automatically to type boolean
alter table anothertab alter column atcol1 drop default;
alter table anothertab alter column atcol1 type boolean
using case when atcol1 % 2 = 0 then true else false end; -- fails