Schema
Owner
postgres
Descriptions
There is no description for function _add_raster_constraint_extent
Options
Option | Value |
---|---|
Returns |
boolean |
Language |
|
Parameters |
rastschema name rasttable name rastcolumn name |
Definition
CREATE OR REPLACE FUNCTION public._add_raster_constraint_extent (
rastschema name,
rasttable name,
rastcolumn name
)
RETURNS boolean AS
$span$
DECLARE
fqtn text;
cn name;
sql text;
attr text; srid integer;
BEGIN
fqtn := '';
IF length($1) > 0 THEN
fqtn := quote_ident($1) || '.';
END IF;
fqtn := fqtn || quote_ident($2);
sql := 'SELECT MAX(public.ST_SRID('
|| quote_ident($3)
|| ') ) FROM '
|| fqtn
|| ' HAVING COUNT(DISTINCT public.ST_SRID('
|| quote_ident($3)
|| ') ) = 1';
EXECUTE sql INTO srid;
cn := 'enforce_max_extent_' || $3;
IF srid > -1 THEN
sql := 'SELECT public.st_ashexewkb( public.st_setsrid( public.st_extent( public.st_envelope('
|| quote_ident($3)
|| ')), ' || srid || ')) FROM '
|| fqtn;
EXECUTE sql INTO attr;
sql := 'ALTER TABLE ' || fqtn
|| ' ADD CONSTRAINT ' || quote_ident(cn)
|| ' CHECK ( public.st_envelope('
|| quote_ident($3)
|| ') @ ''' || attr || '''::geometry) ';
RETURN public._add_raster_constraint(cn, sql);
ELSE
-- no valid srid therefore doesn't make sense to set extent
RETURN false;
END IF;
END;
$span$
LANGUAGE 'plpgsql'
VOLATILE
RETURNS NULL ON NULL INPUT
SECURITY INVOKER
COST 9000;
This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 13/03/2014 13:23 |