select distinct(constraint_name) CONSTRAINT_NAME from information_schema.key_column_usage where constraint_name in ( select rc.constraint_name from information_schema.referential_constraints rc inner join information_schema.table_constraints tc on tc.constraint_name = rc.constraint_name inner join information_schema.table_constraints tc2 on tc2.constraint_name = rc.unique_constraint_name where tc2.constraint_type = 'PRIMARY KEY') and lower(column_name) like 'xxx_%';