Bug #7409 InnoDB: function to count usage of a key as foreign key in the child tables
Submitted: 18 Dec 2004 19:05
Reporter: Zrin Ziborski
Status: Open
Category:Server: InnoDB Severity:S4 (Feature request)
Version: OS:
Assigned to: Heikki Tuuri Target Version:
Triage: D5 (Feature request)

[18 Dec 2004 19:05] Zrin Ziborski
Description:
It would be helpful to have functions like IS_USED() and/or USE_COUNT() that would tell
if a value of (primary) key is used in any child table and how often it is used,
respectively.

e.g.
in child table(s):
	FOREIGN KEY (some_field) REFERENCES film(flm_id)
for parent table `film`
	SELECT USE_COUNT(flm_id) FROM film;
for each row it would return the count of child rows referencing it.

How to repeat:
not applicable (feature request)

Suggested fix:
the functionality is already implemented, it seems that it is just needed to expose this
functions in the API (i.e. as SQL extension).