create type foo as enum ('a','b');
create type bar as enum ('a','b');
select 'a'::foo;
┌─────┐
│ foo │
├─────┤
│ a │
└─────┘
select 'a'::foo::text;
┌──────┐
│ text │
├──────┤
│ a │
└──────┘
select 'a'::foo::text::bar;
┌─────┐
│ bar │
├─────┤
│ a │
└─────┘
Or probably more convenient:
update dogs set
breed = case breed_old
when 'val1' then 'val1'::breed
when 'val2' then 'val2'::breed
...
end;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…