Postgresql – How to fix issue uuid_generate_v1() does not exist in postgresql , actually i have the function under public schema

postgresqluuid

org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [select * from da.test_get(cast(? as integer),cast(? as text),cast(? as text),cast(? as text),cast(? as text))]; nested exception is org.postgresql.util.PSQLException: ERROR: spiexceptions.UndefinedFunction: function uuid_generate_v1() does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Where: Traceback (most recent call last):

enter image description here

Best Answer

Apparently, the CREATE FUNCTION statement used a wrong search path. (This is not shown by \df.)

You can either tell the function to use the value in the environment, or set it explicitly to a correct value:

ALTER FUNCTION da.test_get RESET search_path;
ALTER FUNCTION da.test_get SET search_path = da, public;