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):
2 Answers 2
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;
-
Great idea, i will have a try. Actually this error in the system can not be replay every time. It happens by chance.Jeremy– Jeremy2018年09月14日 03:34:11 +00:00Commented Sep 14, 2018 at 3:34
I faced similar problem and literally nothing worked for me... So I executed this in my custom schema as a workaround:
create function uuid_generate_v1() returns uuid
strict
parallel safe
language plpgsql
as
$$
begin
RETURN public.uuid_generate_v1();
end;
$$;
Now you are free to use this function just normally in your schema with no need to use public.
prefix:
SELECT uuid_generate_v1()
da.test_get
?