Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Obtain Current Schema Name During PL Runtime

Status
Not open for further replies.

gwinn7

Programmer
Feb 10, 2001
1,004
US
Just wondering if anyone knew how to obtain the schema name of a currently running function.

For example…

CREATE OR REPLACE FUNCTION test.myfunction() RETURNS text AS $$
BEGIN
return function_schema();
END $$ LANGUAGE ‘plpgsql’;


I realize there is “current_schema()” function, but it seems to display the initial schema in the search path, not of the schema of the running function. What I would expect to get is “test”.

Does anyone know a way to obtain this?

What I am trying to accomplish is to be able to port my code to different schemas when the code itself contains schema specific referenced code.

Thanks in advance,
gwinn7
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top