Schema
Owner
postgres
Descriptions
There is no description for function _add_raster_constraint_srid
Options
Option | Value |
---|---|
Returns |
boolean |
Language |
|
Parameters |
rastschema name rasttable name rastcolumn name |
Definition
CREATE OR REPLACE FUNCTION public._add_raster_constraint_srid (
rastschema name,
rasttable name,
rastcolumn name
)
RETURNS boolean AS
$span$
DECLARE
fqtn text;
cn name;
sql text;
attr int;
BEGIN
fqtn := '';
IF length($1) > 0 THEN
fqtn := quote_ident($1) || '.';
END IF;
fqtn := fqtn || quote_ident($2);
cn := 'enforce_srid_' || $3;
sql := 'SELECT st_srid('
|| quote_ident($3)
|| ') FROM ' || fqtn
|| ' LIMIT 1';
BEGIN
EXECUTE sql INTO attr;
EXCEPTION WHEN OTHERS THEN
RAISE NOTICE 'Unable to get the SRID of a sample raster: % (%)',
SQLERRM, SQLSTATE;
RETURN FALSE;
END;
sql := 'ALTER TABLE ' || fqtn
|| ' ADD CONSTRAINT ' || quote_ident(cn)
|| ' CHECK (st_srid('
|| quote_ident($3)
|| ') = ' || attr || ')';
RETURN public._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 |