偶小梦
发布于

删除oushudb中的magma表信息

➢ 问题
在 magma 端初始化后,如何删除 hawq catalog 中的 magma 表信息而不重新初始化 hawq?

➢ 解答
cat delete_catalog.sh export PGOPTIONS='-c gp_session_role=utility' database=$1 schema=$2 tablename=$3 oid=`psql -Atc "select oid from pg_class where relname=lower('{tablename}') and exists (select 1 from pg_namespace where nspname='{schema}' and oid=pg_class.relnamespace);" -d database`
echo "
begin;
set allow_system_table_mods='dml';
delete from gp_distribution_policy where localoid='{oid}'; delete from pg_type where typrelid='{oid}';
delete from pg_depend where refobjid='{oid}'; delete from pg_attribute where attrelid='{oid}';
delete from pg_exttable where reloid='{oid}'; delete from pg_class where oid='{oid}';
commit;
" |psql -d postgres

评论
    test