URX_PUBLIC._overview_constraint_info(ovschema name, ovtable name, ovcolumn name) - Procedure
Home|Tables|Schemas|Diagrams|Foreign Keys|Indexes

NameURX_PUBLIC._overview_constraint_info(ovschema name, ovtable name, ovcolumn name)
Comment
Src
CREATE FUNCTION "URX_PUBLIC"."_overview_constraint_info"(ovschema name, ovtable name, ovcolumn name) 
 RETURNS record AS 
$BODY$
	SELECT
		split_part(split_part(s.consrc, '''::name', 1), '''', 2)::name,
		split_part(split_part(s.consrc, '''::name', 2), '''', 2)::name,
		split_part(split_part(s.consrc, '''::name', 3), '''', 2)::name,
		trim(both from split_part(s.consrc, ',', 2))::integer
	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 '%_overview_constraint(%'
	$BODY$
 LANGUAGE 'sql' STABLESTRICT ;