I have spring data repository interface like this:
public interface MyEntityRepository extends
JpaRepository<MyEntity, Long> {
@Query(nativeQuery = true, value = "select * from my_func(:myList)")
Page<MyEntity> findBy(
@NonNull @Param("myList") List<String> myList,
@NonNull Pageable pageable);
}
Postgres' function I have defined like this (but I can change it if I did it wrong):
CREATE OR REPLACE FUNCTION my_func(variadic myList text[])
RETURNS SETOF myEntityTable AS $$
... some logic
select * from myEntityTable t where t.foo in (myList);
When I call this repository method I got this error:
ERROR: operator does not exist: character varying = text[]
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Where: PL/pgSQL function f_najdi_autorizaciu_na_spracovanie(text[]) line 28 at RETURN QUERY
Can you please tell me what type should I use in my postgres function? Thank you in advice.
EDIT: I cannot use native query above repository method and pass there list into IN clause because I have in DB function more logic, variables and so on ... it have to be DB function.