Kasun
Kasun

Reputation: 682

How can I find where a Mysql function is used?

I'm using Mysql 8. There is a function called calculateGP used in one of the viewes I'm working on. I want to modify this function but I'm not sure if the function is used elsewhere in the database. Is there a query that I can run to know where else the function is referenced in the database?

Upvotes: 3

Views: 1538

Answers (2)

Bill Karwin
Bill Karwin

Reputation: 562378

I would do this:

SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.VIEWS
WHERE VIEW_DEFINITION LIKE '%`calculateGP`%'

This might find false matches if you have tables or columns or other identifiers that are also named calculateGP.

Upvotes: 2

Kasun
Kasun

Reputation: 682

I was able to find references to the function calculateGP by taking a MySQL structural dump of the database and by doing a text search on the dump file. This is an alternative method of finding the references in the database without running a MySQL query to do so.

Upvotes: 0

Related Questions