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

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

		BEGIN
			EXECUTE 'ALTER TABLE '
				|| fqtn
				|| ' DROP CONSTRAINT '
				|| quote_ident(cn);
			RETURN TRUE;
		EXCEPTION
			WHEN undefined_object THEN
				RAISE NOTICE 'The constraint "%" does not exist.  Skipping', cn;
			WHEN OTHERS THEN
				RAISE NOTICE 'Unable to drop constraint "%": % (%)',
          cn, SQLERRM, SQLSTATE;
				RETURN FALSE;
		END;

		RETURN TRUE;
	END;
	$BODY$
 LANGUAGE 'plpgsql' VOLATILESTRICT ;