多次运行不会报错
DO language plpgsql $$ BEGIN RAISE INFO '*************** test_add_column.sql begins'' ***************';
if not exists (select 1 from information_schema.columns where table_schema = 'public' and table_name = 'qer_simutrade_param' and column_name = 'pool_id') then RAISE INFO '*************** column npool_id not exist,add now... ***************';
alter table public.qer_simutrade_param add column pool_id varchar;
end if;
RAISE INFO '*************** test_add_column.sql completes'' ***************';
EXCEPTION
WHEN OTHERS THEN
RAISE NOTICE '*************** Patch ''test_add_column.sql'' fails : ErrCode (%) (%)',sqlSTATE,sqlERRM;
RAISE;
END;
$$;