Where I can find my PLPython functions in Postgres?
Asked Answered
E

1

0

I've created some functions in a specific schema, but the "Functions" section has nothing inside..

I create functions like this example:

CREATE FUNCTION pymax (a integer, b integer)
  RETURNS integer
AS $$
  if a > b:
  return a
return b
$$ LANGUAGE plpythonu;
Elutriate answered 5/4, 2013 at 14:15 Comment(2)
Can you show us the code used for the function creation ?Zarger
the "Functions" section where? In pgAdmin?Uzia
U
1

If the name is not schema-qualified, a function (like other objects) is created in your current schema. Your current schema is defined by the current setting of search_path.

To see your current search_path:

SHOW search_path;

There are a number of ways to set the search_path, more in this related answer:
How does the search_path influence identifier resolution and the "current schema"

To find out whether any function with a similar name exists in your database:

SELECT n.nspname, p.proname, pg_get_function_arguments(p.oid) As args
FROM   pg_proc p
JOIN   pg_namespace n ON n.oid = p.pronamespace
WHERE  p.proname ILIKE '%pymax%';

If that doesn't find anything, the functions doesn't exist in this database. Maybe you created it in another db by mistake?

Uzia answered 5/4, 2013 at 18:36 Comment(1)
Thanks, I've edited answer to search in namespace. (I don't know functions name =D)Elutriate

© 2022 - 2024 — McMap. All rights reserved.