Fix ALTER TYPE for multi-command string

This commit is contained in:
Jesús Arroyo Torrens 2021-03-31 15:58:30 +02:00
parent d4dc60783e
commit f12e25117e
2 changed files with 14 additions and 2 deletions

View File

@ -12,7 +12,13 @@ CREATE TYPE cdb_dataservices_client.obs_meta_denominator AS (denom_id text, deno
CREATE TYPE cdb_dataservices_client.obs_meta_geometry AS (geom_id text, geom_name text, geom_description text, geom_weight text, geom_aggregate text, geom_license text, geom_source text, valid_numer boolean, valid_denom boolean, valid_timespan boolean, score numeric, numtiles bigint, notnull_percent numeric, numgeoms numeric, percentfill numeric, estnumgeoms numeric, meanmediansize numeric, geom_type text, geom_extra jsonb, geom_tags jsonb); CREATE TYPE cdb_dataservices_client.obs_meta_geometry AS (geom_id text, geom_name text, geom_description text, geom_weight text, geom_aggregate text, geom_license text, geom_source text, valid_numer boolean, valid_denom boolean, valid_timespan boolean, score numeric, numtiles bigint, notnull_percent numeric, numgeoms numeric, percentfill numeric, estnumgeoms numeric, meanmediansize numeric, geom_type text, geom_extra jsonb, geom_tags jsonb);
CREATE TYPE cdb_dataservices_client.obs_meta_timespan AS (timespan_id text, timespan_name text, timespan_description text, timespan_weight text, timespan_aggregate text, timespan_license text, timespan_source text, valid_numer boolean, valid_denom boolean, valid_geom boolean, timespan_type text, timespan_extra jsonb, timespan_tags jsonb); CREATE TYPE cdb_dataservices_client.obs_meta_timespan AS (timespan_id text, timespan_name text, timespan_description text, timespan_weight text, timespan_aggregate text, timespan_license text, timespan_source text, valid_numer boolean, valid_denom boolean, valid_geom boolean, timespan_type text, timespan_extra jsonb, timespan_tags jsonb);
ALTER TYPE cdb_dataservices_client.service_type ADD VALUE 'observatory' AFTER 'routing'; WITH c AS (
SELECT pg_type.oid as id
FROM pg_type INNER JOIN pg_namespace ON (pg_type.typnamespace = pg_namespace.oid)
WHERE pg_type.typname = 'service_type' AND pg_namespace.nspname = 'cdb_dataservices_client'
)
INSERT INTO pg_enum (enumtypid, enumsortorder, enumlabel)
SELECT c.id, 4, 'observatory' FROM c;
CREATE OR REPLACE FUNCTION cdb_dataservices_client.obs_get_demographic_snapshot (geom public.geometry(Geometry, 4326) ,time_span text DEFAULT '2009 - 2013'::text ,geometry_level text DEFAULT NULL) CREATE OR REPLACE FUNCTION cdb_dataservices_client.obs_get_demographic_snapshot (geom public.geometry(Geometry, 4326) ,time_span text DEFAULT '2009 - 2013'::text ,geometry_level text DEFAULT NULL)
RETURNS json AS $$ RETURNS json AS $$

View File

@ -1446,7 +1446,13 @@ RETURNS boolean AS $$
return True return True
$$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED; $$ LANGUAGE @@plpythonu@@ SECURITY DEFINER STABLE PARALLEL RESTRICTED;
ALTER TYPE cdb_dataservices_server.service_type ADD VALUE 'observatory' AFTER 'routing'; WITH c AS (
SELECT pg_type.oid as id
FROM pg_type INNER JOIN pg_namespace ON (pg_type.typnamespace = pg_namespace.oid)
WHERE pg_type.typname = 'service_type' AND pg_namespace.nspname = 'cdb_dataservices_server'
)
INSERT INTO pg_enum (enumtypid, enumsortorder, enumlabel)
SELECT c.id, 4, 'observatory' FROM c;
CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_quota_info( CREATE OR REPLACE FUNCTION cdb_dataservices_server.cdb_service_quota_info(
username TEXT, username TEXT,