2017-01-10 30 views
0

這看起來像是一個轉儲問題。但是,我有這個運行PostGIS的遺留數據庫(但不再是),並且在轉儲中仍然有大量的特定於PostGIS的代碼。像這樣的東西:如何卸載PostGIS遺留問題(預擴展)

CREATE TYPE box2d (
    INTERNALLENGTH = 65, 
    INPUT = box2d_in, 
    OUTPUT = box2d_out, 
    ALIGNMENT = int4, 
    STORAGE = plain 
); 

CREATE FUNCTION _st_concavehull(param_inputgeom geometry) RETURNS geometry 
    LANGUAGE plpgsql IMMUTABLE STRICT 
    AS $$ 
     DECLARE 
     vexhull GEOMETRY; 
     var_resultgeom geometry; 
     var_inputgeom geometry; 
     vexring GEOMETRY; 
     cavering GEOMETRY; 
     cavept geometry[]; 
     seglength double precision; 
     var_tempgeom geometry; 
     scale_factor integer := 1; 
     i integer; 

     BEGIN 

       -- First compute the ConvexHull of the geometry 
       vexhull := ST_ConvexHull(param_inputgeom); 
       var_inputgeom := param_inputgeom; 
       ... 

(你的想法)。

我很失去任何GIS相關的數據,我不應該有任何。在傾銷和重新加載方面我也很好,但是不這樣做顯然會更好。

感謝

+1

我不認爲這是對卸載OLT PostGIS的東西的工具,但如果你刪除使用'DROP TYPE ... CASCADE的PostGIS的類型;',你也將去除大部分的postgis功能。 Postgis類型是:'geometry','geometry_dump','box2d','box3d','geography'和其他一些。 –

+0

不錯,謝謝!我猜想,這也將刪除功能,對吧? – Nuschk

+0

是的,我想通了。謝謝你的幫助! – Nuschk

回答

0

FWIW,因爲似乎沒有成爲一個正式的卸載腳本(即我所知道的),這是我在結束運行,刪除所有數據類型和功能的腳本通過PostGIS的創建:

DROP TYPE IF EXISTS box2d CASCADE; 
DROP TYPE IF EXISTS box2df CASCADE; 
DROP TYPE IF EXISTS box3d CASCADE; 
DROP TYPE IF EXISTS geography CASCADE; 
DROP TYPE IF EXISTS geometry CASCADE; 
DROP TYPE IF EXISTS geometry_dump CASCADE; 
DROP TYPE IF EXISTS gidx CASCADE; 
DROP TYPE IF EXISTS pgis_abs CASCADE; 
DROP TYPE IF EXISTS spheroid CASCADE; 
DROP TYPE IF EXISTS valid_detail CASCADE; 

DROP TABLE IF EXISTS spatial_ref_sys CASCADE; 

DROP FUNCTION IF EXISTS _postgis_join_selectivity(regclass, text, regclass, text, text) CASCADE; 
DROP FUNCTION IF EXISTS _postgis_stats(tbl regclass, att_name text, text) CASCADE; 
DROP FUNCTION IF EXISTS checkauth(text, text) CASCADE; 
DROP FUNCTION IF EXISTS checkauthtrigger() CASCADE; 
DROP FUNCTION IF EXISTS dropgeometrytable(table_name character varying) CASCADE; 
DROP FUNCTION IF EXISTS dropgeometrytable(schema_name character varying, table_name character varying) CASCADE; 
DROP FUNCTION IF EXISTS geography_analyze(internal) CASCADE; 
DROP FUNCTION IF EXISTS geography_gist_compress(internal) CASCADE; 
DROP FUNCTION IF EXISTS geography_gist_decompress(internal) CASCADE; 
DROP FUNCTION IF EXISTS geography_gist_penalty(internal, internal, internal) CASCADE; 
DROP FUNCTION IF EXISTS geography_gist_picksplit(internal, internal) CASCADE; 
DROP FUNCTION IF EXISTS geography_gist_union(bytea, internal) CASCADE; 
DROP FUNCTION IF EXISTS geography_typmod_in(cstring[]) CASCADE; 
DROP FUNCTION IF EXISTS geography_typmod_out(integer) CASCADE; 
DROP FUNCTION IF EXISTS geometry_analyze(internal) CASCADE; 
DROP FUNCTION IF EXISTS geometry_gist_compress_2d(internal) CASCADE; 
DROP FUNCTION IF EXISTS geometry_gist_compress_nd(internal) CASCADE; 
DROP FUNCTION IF EXISTS geometry_gist_decompress_2d(internal) CASCADE; 
DROP FUNCTION IF EXISTS geometry_gist_decompress_nd(internal) CASCADE; 
DROP FUNCTION IF EXISTS geometry_gist_penalty_2d(internal, internal, internal) CASCADE; 
DROP FUNCTION IF EXISTS geometry_gist_penalty_nd(internal, internal, internal) CASCADE; 
DROP FUNCTION IF EXISTS geometry_gist_picksplit_2d(internal, internal) CASCADE; 
DROP FUNCTION IF EXISTS geometry_gist_picksplit_nd(internal, internal) CASCADE; 
DROP FUNCTION IF EXISTS geometry_gist_union_2d(bytea, internal) CASCADE; 
DROP FUNCTION IF EXISTS geometry_gist_union_nd(bytea, internal) CASCADE; 
DROP FUNCTION IF EXISTS geometry_typmod_in(cstring[]) CASCADE; 
DROP FUNCTION IF EXISTS geometry_typmod_out(integer) CASCADE; 
DROP FUNCTION IF EXISTS gettransactionid() CASCADE; 
DROP FUNCTION IF EXISTS gserialized_gist_joinsel_2d(internal, oid, internal, smallint) CASCADE; 
DROP FUNCTION IF EXISTS gserialized_gist_joinsel_nd(internal, oid, internal, smallint) CASCADE; 
DROP FUNCTION IF EXISTS gserialized_gist_sel_2d(internal, oid, internal, integer) CASCADE; 
DROP FUNCTION IF EXISTS gserialized_gist_sel_nd(internal, oid, internal, integer) CASCADE; 
DROP FUNCTION IF EXISTS lockrow(text, text, text) CASCADE; 
DROP FUNCTION IF EXISTS lockrow(text, text, text, text) CASCADE; 
DROP FUNCTION IF EXISTS lockrow(text, text, text, timestamp without time zone) CASCADE; 
DROP FUNCTION IF EXISTS postgis_cache_bbox() CASCADE; 
DROP FUNCTION IF EXISTS postgis_constraint_dims(geomschema text, geomtable text, geomcolumn text) CASCADE; 
DROP FUNCTION IF EXISTS postgis_constraint_srid(geomschema text, geomtable text, geomcolumn text) CASCADE; 
DROP FUNCTION IF EXISTS postgis_constraint_type(geomschema text, geomtable text, geomcolumn text) CASCADE; 
DROP FUNCTION IF EXISTS postgis_geos_version() CASCADE; 
DROP FUNCTION IF EXISTS postgis_lib_build_date() CASCADE; 
DROP FUNCTION IF EXISTS postgis_lib_version() CASCADE; 
DROP FUNCTION IF EXISTS postgis_libjson_version() CASCADE; 
DROP FUNCTION IF EXISTS postgis_libxml_version() CASCADE; 
DROP FUNCTION IF EXISTS postgis_proj_version() CASCADE; 
DROP FUNCTION IF EXISTS postgis_scripts_build_date() CASCADE; 
DROP FUNCTION IF EXISTS postgis_scripts_installed() CASCADE; 
DROP FUNCTION IF EXISTS postgis_scripts_released() CASCADE; 
DROP FUNCTION IF EXISTS postgis_svn_version() CASCADE; 
DROP FUNCTION IF EXISTS postgis_type_name(geomname character varying, coord_dimension integer, use_new_name boolean) CASCADE; 
DROP FUNCTION IF EXISTS postgis_typmod_dims(integer) CASCADE; 
DROP FUNCTION IF EXISTS postgis_typmod_srid(integer) CASCADE; 
DROP FUNCTION IF EXISTS postgis_typmod_type(integer) CASCADE; 
DROP FUNCTION IF EXISTS postgis_version() CASCADE; 
DROP FUNCTION IF EXISTS st_area(text) CASCADE; 
DROP FUNCTION IF EXISTS st_asewkt(text) CASCADE; 
DROP FUNCTION IF EXISTS st_asgeojson(text) CASCADE; 
DROP FUNCTION IF EXISTS st_asgml(text) CASCADE; 
DROP FUNCTION IF EXISTS st_askml(text) CASCADE; 
DROP FUNCTION IF EXISTS st_assvg(text) CASCADE; 
DROP FUNCTION IF EXISTS st_astext(text) CASCADE; 
DROP FUNCTION IF EXISTS st_coveredby(text, text) CASCADE; 
DROP FUNCTION IF EXISTS st_covers(text, text) CASCADE; 
DROP FUNCTION IF EXISTS st_distance(text, text) CASCADE; 
DROP FUNCTION IF EXISTS st_dwithin(text, text, double precision) CASCADE; 
DROP FUNCTION IF EXISTS st_intersects(text, text) CASCADE; 
DROP FUNCTION IF EXISTS st_length(text) CASCADE; 
DROP FUNCTION IF EXISTS st_relatematch(text, text) CASCADE; 
+1

不錯的工作,但PLPGSQL不是特定於postgis,而是本地Postgres過程語言。這是行是一個錯誤,必須刪除:'DROP EXTENSION如果存在plpgsql CASCADE;' –

+0

哈哈,很好的接收,謝謝!我還沒有部署它,所以這很接近。 – Nuschk