Src |
CREATE FUNCTION "URX_PUBLIC"."_drop_raster_constraint_spatially_unique"(rastschema name, rasttable name, rastcolumn name)
RETURNS boolean AS
$BODY$
DECLARE
cn text;
BEGIN
SELECT
s.conname INTO cn
FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s, pg_index idx, pg_operator op
WHERE n.nspname = $1
AND c.relname = $2
AND a.attname = $3
AND a.attrelid = c.oid
AND s.connamespace = n.oid
AND s.conrelid = c.oid
AND s.contype = 'x'
AND 0::smallint = ANY (s.conkey)
AND idx.indexrelid = s.conindid
AND pg_get_indexdef(idx.indexrelid, 1, true) LIKE '(' || quote_ident($3) || '::geometry)'
AND s.conexclop[1] = op.oid
AND op.oprname = '=';
RETURN "URX_PUBLIC"._drop_raster_constraint($1, $2, cn);
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILESTRICT ;
|