Function to Table reference

Started by akp geekalmost 16 years ago4 messagesgeneral
Jump to latest
#1akp geek
akpgeek@gmail.com

Hi All -

Is there a way to find which functions are being used by table.
Ex :- If there are functions fnc_a, fnc_b, fnc_c and table A is used in
fnc_a and fnc_c, How can we find that ? can you please help?

regards

#2Tim Landscheidt
tim@tim-landscheidt.de
In reply to: akp geek (#1)
Re: Function to Table reference

(anonymous) wrote:

Is there a way to find which functions are being used by table.
Ex :- If there are functions fnc_a, fnc_b, fnc_c and table A is used in
fnc_a and fnc_c, How can we find that ? can you please help?

Basically, you can't. Functions are more or less black boxes
to PostgreSQL.

Tim

#3akp geek
akpgeek@gmail.com
In reply to: Tim Landscheidt (#2)
Re: Function to Table reference

got it.. Thank you

On Fri, Apr 30, 2010 at 12:17 PM, Tim Landscheidt <tim@tim-landscheidt.de>wrote:

Show quoted text

(anonymous) wrote:

Is there a way to find which functions are being used by table.
Ex :- If there are functions fnc_a, fnc_b, fnc_c and table A is used

in

fnc_a and fnc_c, How can we find that ? can you please help?

Basically, you can't. Functions are more or less black boxes
to PostgreSQL.

Tim

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tim Landscheidt (#2)
Re: Function to Table reference

Tim Landscheidt <tim@tim-landscheidt.de> writes:

(anonymous) wrote:

Is there a way to find which functions are being used by table.
Ex :- If there are functions fnc_a, fnc_b, fnc_c and table A is used in
fnc_a and fnc_c, How can we find that ? can you please help?

Basically, you can't. Functions are more or less black boxes
to PostgreSQL.

You could possibly grep all the functions' source code for references to
the particular table you care about, eg

select ... from pg_proc where prosrc ~ 'mytable'

but bear in mind that this could miss dynamically-constructed queries.

regards, tom lane