SahAssar dc1e21fccc
Change typecheck to perform within the current namespace/schema (#1389)
This PR fixes #1388 by doing a test cast for the type and if it fails adding the type.
2022-07-26 12:26:46 +02:00

13 lines
349 B
SQL

DO
$$
BEGIN
PERFORM 'city_place'::regtype;
EXCEPTION
WHEN undefined_object THEN
CREATE TYPE city_place AS enum ('city', 'town', 'village', 'hamlet', 'suburb', 'quarter', 'neighbourhood', 'isolated_dwelling');
END
$$;
ALTER TABLE osm_city_point
ALTER COLUMN place TYPE city_place USING place::city_place;