1. 生成脚本
SELECTn.nspname as "Schema",c.relname as "Table",c.relhasoids as "With OIDs", 'ALTER TABLE '|| n.nspname ||'.' || c.relname || ' SET WITHOUT OIDS;'
FROMpg_class cJOIN pg_namespace n ON n.oid = c.relnamespace
WHEREc.relkind = 'r' and n.nspname <>'pg_catalog' and n.nspname <> 'topology' AND c.relhasoids = 't';
2. 执行生成脚本