Adapt src for Postgis 3.0

remotes/origin/mkas^2
Raúl Marín 5 years ago
parent d6990134b6
commit ebf2c92f08

@ -1,3 +1,16 @@
-- In Postgis 3+, geomval is part of postgis_raster
-- Trying to workaround it by creating the type ourselves leads to other issues:
-- - If we create it under public, then if we try to create postgis_raster afterwards it will fail (ERROR: type "geomval" already exists).
-- - If we create it under cdb_observatory, then things work until we install postgis_raster. At that moment depending on how
-- the search_path is set (per call, function, user...) we start getting random errors since it's mixing public.geomval and
-- cdb_observatory.geomval (function cdb_observatory.obs_getdata(geomval[], json) does not exist)
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'geomval') THEN
RAISE EXCEPTION 'Missing `geomval` type. Use `CREATE EXTENSION postgis_raster` to enable it.';
END IF;
END$$;
-- Returns the table name with geoms for the given geometry_id
-- TODO probably needs to take in the column_id array to get the relevant

@ -516,8 +516,8 @@ BEGIN
WHEN numer_id IS NULL THEN
'''geomref'', ' || 'cdb_observatory.FIRST(' || geom_tablename ||
'.' || geom_geomref_colname || '), ' ||
'''value'', ' || 'cdb_observatory.FIRST(' || geom_tablename ||
'.' || geom_colname || ')'
'''value'', ' || '(cdb_observatory.FIRST(' || geom_tablename ||
'.' || geom_colname || '))::TEXT' -- Needed to force text output in Postgis 3+, later parsed automagically by ::Geometry. Otherwise we'd get geojson output
ELSE ''
END || ')', ', ')
AS colspecs,

Loading…
Cancel
Save