master
黄海 4 years ago
parent ab69336254
commit bb3b4c6e55

@ -15,3 +15,13 @@ where relkind = 'r' and relname like 'j%_r' and relname not like 'pg_%' and rel
-- 删除默认值
ALTER TABLE table_name ALTER COLUMN column_name DROP DEFAULT;
select 'alter table '||pg_class.relname || ' drop constraint '|| pg_constraint.conname ||';' as pk_name from
pg_constraint inner join pg_class
on pg_constraint.conrelid = pg_class.oid
inner join pg_attribute on pg_attribute.attrelid = pg_class.oid
and pg_attribute.attnum = pg_constraint.conkey[1]
inner join pg_type on pg_type.oid = pg_attribute.atttypid where pg_attribute.attname='rowid'
-- where pg_class.relname = 'teacher'
and pg_constraint.contype='p'

Loading…
Cancel
Save