URX_PUBLIC._add_raster_constraint_spatially_unique(rastschema name, rasttable name, rastcolumn name) - Procedure
Home|Tables|Schemas|Diagrams|Foreign Keys|Indexes

NameURX_PUBLIC._add_raster_constraint_spatially_unique(rastschema name, rasttable name, rastcolumn name)
Comment
Src
CREATE FUNCTION "URX_PUBLIC"."_add_raster_constraint_spatially_unique"(rastschema name, rasttable name, rastcolumn name) 
 RETURNS boolean AS 
$BODY$
	DECLARE
		fqtn text;
		cn name;
		sql text;
		attr text;
		meta record;
	BEGIN
		fqtn := '';
		IF length($1) > 0 THEN
			fqtn := quote_ident($1) || '.';
		END IF;
		fqtn := fqtn || quote_ident($2);

		cn := 'enforce_spatially_unique_' || quote_ident($2) || '_'|| $3;

		sql := 'ALTER TABLE ' || fqtn ||
			' ADD CONSTRAINT ' || quote_ident(cn) ||
			' EXCLUDE ((' || quote_ident($3) || '::geometry) WITH =)';
		RETURN  "URX_PUBLIC"._add_raster_constraint(cn, sql);
	END;
	$BODY$
 LANGUAGE 'plpgsql' VOLATILESTRICT ;