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

NameURX_PUBLIC._raster_constraint_info_blocksize(rastschema name, rasttable name, rastcolumn name, axis text)
Comment
Src
CREATE FUNCTION "URX_PUBLIC"."_raster_constraint_info_blocksize"(rastschema name, rasttable name, rastcolumn name, axis text) 
 RETURNS integer AS 
$BODY$
	SELECT
		CASE
			WHEN strpos(s.consrc, 'ANY (ARRAY[') > 0 THEN
				split_part((substring(s.consrc FROM E'ARRAY\\[(.*?){1}\\]')), ',', 1)::integer
			ELSE
				regexp_replace(
					split_part(s.consrc, '= ', 2),
					'[\(\)]', '', 'g'
				)::integer
			END
	FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s
	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 a.attnum = ANY (s.conkey)
		AND s.consrc LIKE '%st_' || $4 || '(%= %';
	$BODY$
 LANGUAGE 'sql' STABLESTRICT ;