drop table aodb_patch; create table aodb_patch (patch integer unique primary key, name text); insert into aodb_patch select distinct on (patch) patch, substring(patch, 1, 2)::integer || '.' || substring(patch, 3, 2)::integer || case when (substring(patch, 5, 2)::integer = 0 and substring(patch, 7, 2)::integer = 0) then '' else '.' || substring(patch, 5, 2)::integer end || case when (substring(patch, 7, 2)::integer = 0) then '' else '.' || substring(patch, 7, 2)::integer end from aodb where current is true; drop table aodb_name; create table aodb_name (xid integer unique primary key, name text); insert into aodb_name select aodb.xid, name from aodb_ext,aodb where aodb.xid = aodb_ext.xid and aodb.current is true; vacuum analyze aodb; vacuum analyze aodb_ext; vacuum analyze aodb_eff; vacuum analyze aodb_req; vacuum analyze aodb_nano; vacuum analyze aodb_name; vacuum analyze aodb_skill; vacuum analyze aodb_other;