Fix creation of type _cdb_has_usable_geom_record

Fix the ERROR:  type "_cdb_has_usable_geom_record" already exists by
checking for existence before. Duly noted for upgrades.
This commit is contained in:
Rafa de la Torre
2015-09-21 14:16:32 +02:00
parent 0c14df5f89
commit 5ea1b7d4d7
+5 -1
View File
@@ -688,7 +688,9 @@ BEGIN
END; END;
$$ LANGUAGE 'plpgsql'; $$ LANGUAGE 'plpgsql';
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = '_cdb_has_usable_geom_record') THEN
CREATE TYPE _cdb_has_usable_geom_record CREATE TYPE _cdb_has_usable_geom_record
AS (has_usable_geoms boolean, AS (has_usable_geoms boolean,
text_geom_column boolean, text_geom_column boolean,
@@ -698,6 +700,8 @@ CREATE TYPE _cdb_has_usable_geom_record
has_geom_name text, has_geom_name text,
has_mercgeom boolean, has_mercgeom boolean,
has_mercgeom_name text); has_mercgeom_name text);
END IF;
END$$;
DROP FUNCTION IF EXISTS _CDB_Has_Usable_Geom(REGCLASS); DROP FUNCTION IF EXISTS _CDB_Has_Usable_Geom(REGCLASS);
CREATE OR REPLACE FUNCTION _CDB_Has_Usable_Geom(reloid REGCLASS) CREATE OR REPLACE FUNCTION _CDB_Has_Usable_Geom(reloid REGCLASS)