PostgreSQL批量改数据类型

来源:这里教程网 时间:2026-03-14 20:38:35 作者:

登录到所在库执行

select 'alter table '|| table_name || ' alter column ' || column_name || ' type varchar('|| character_maximum_length||');' as alter_integer_ddl
from information_schema.columns
where data_type like '%pbchar%'
-- and table_name not like '%sys_p%'
and table_schema = 'ta6xxxx'
order by table_name;

相关推荐