From 463fe974814f704354e64f90f919891b5937f5a0 Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Sat, 7 Nov 2015 10:10:17 +0000 Subject: [PATCH] _raster_constraint_info_scale gives invalid input syntax references #3360 fix for PostGIS 2.3 (trunk) git-svn-id: http://svn.osgeo.org/postgis/trunk@14371 b70326c6-7e19-0410-871a-916f4a2858ee --- raster/rt_pg/rtpostgis.sql.in | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/raster/rt_pg/rtpostgis.sql.in b/raster/rt_pg/rtpostgis.sql.in index cff84c4ea..94c7adfa5 100644 --- a/raster/rt_pg/rtpostgis.sql.in +++ b/raster/rt_pg/rtpostgis.sql.in @@ -6947,7 +6947,7 @@ CREATE OR REPLACE FUNCTION _drop_raster_constraint_srid(rastschema name, rasttab CREATE OR REPLACE FUNCTION _raster_constraint_info_scale(rastschema name, rasttable name, rastcolumn name, axis char) RETURNS double precision AS $$ - SELECT + WITH c AS (SELECT regexp_replace( replace( split_part( @@ -6957,7 +6957,7 @@ CREATE OR REPLACE FUNCTION _raster_constraint_info_scale(rastschema name, rastta 'round(', '' ), '[ ''''\(\)]', '', 'g' - )::double precision + )::text AS val FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s WHERE n.nspname = $1 AND c.relname = $2 @@ -6966,7 +6966,12 @@ CREATE OR REPLACE FUNCTION _raster_constraint_info_scale(rastschema name, rastta AND s.connamespace = n.oid AND s.conrelid = c.oid AND a.attnum = ANY (s.conkey) - AND s.consrc LIKE '%st_scale' || $4 || '(% = %'; + AND s.consrc LIKE '%st_scale' || $4 || '(% = %') +-- if it is a comma separated list of two numbers then need to use round + SELECT CASE WHEN split_part(c.val,',', 2) > '' + THEN round( split_part(c.val, ',',1)::numeric, split_part(c.val,',',2)::integer )::float8 + ELSE c.val::float8 END + FROM c; $$ LANGUAGE sql STABLE STRICT COST 100; -- 2.40.0