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.
This commit is contained in:
SahAssar
2022-07-26 12:26:46 +02:00
committed by GitHub
parent da7b1b1645
commit dc1e21fccc
3 changed files with 9 additions and 8 deletions

View File

@@ -1,9 +1,10 @@
DO
$$
BEGIN
IF NOT EXISTS(SELECT 1 FROM pg_type WHERE typname = 'city_place') THEN
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 IF;
END
$$;