pggeodb.nancy.inra.fr/db_cefs - db_cefs on pggeodb.nancy.inra.fr
Previous topic Chapter index Next topic

Function: _add_raster_constraint_extent

 

 

Schema

public

 

Owner

postgres

 

Descriptions

There is no description for function _add_raster_constraint_extent

 

Options

Option

Value

Returns

boolean

Language

plpgsql

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;
BEGIN
fqtn := '';
IF length($1) > 0 THEN
fqtn := quote_ident($1) || '.';
END IF;
fqtn := fqtn || quote_ident($2);

cn := 'enforce_max_extent_' || $3;

sql := 'SELECT st_ashexewkb(st_envelope(st_collect(st_envelope('
|| quote_ident($3)
|| ')))) FROM '
|| fqtn;
EXECUTE sql INTO attr;

sql := 'ALTER TABLE ' || fqtn
|| ' ADD CONSTRAINT ' || quote_ident(cn)
|| ' CHECK (st_envelope('
|| quote_ident($3)
|| ') @ ''' || attr || '''::geometry)';
RETURN _add_raster_constraint(cn, sql);
END;
$span$
LANGUAGE
'plpgsql'
VOLATILE
RETURNS NULL ON NULL INPUT
SECURITY INVOKER
COST
100;

This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 13/03/2014 13:23
Previous topic Chapter index Next topic