JPA PostgreSQL 오류: ll_to_earth(numeric, numeric) 이름의 함수가 없음 해결 방법
-
반응형
2024-04-08
1. 이슈 발생
이미 extension으로 cube와 earthdistance를 설치함에도 불구하고 아래와 같은 에러가 발생했다.
> create extension cube
[2024-03-26 10:25:45] [42710] 오류: "cube" 이름의 확장 모듈이 이미 있습니다
> create extension earthdistance
[2024-03-26 10:25:57] [42710] 오류: "earthdistance" 이름의 확장 모듈이 이미 있습니다
> select
,trh.latitude
,trh.longitude
from test_tb
where
earth_distance(ll_to_earth(37.60929341197407, 127.05318831597205)
, ll_to_earth(trh.latitude, trh.longitude)) < 1000
[2024-03-26 10:26:04] [42883] 오류: ll_to_earth(numeric, numeric) 이름의 함수가 없음
[2024-03-26 10:26:04] Hint: 지정된 이름 및 인자 자료형과 일치하는 함수가 없습니다. 명시적 형변환자를 추가해야 할 수도 있습니다.
2. 원인
create extension 사용 시 스키마를 지정해 주지 않으면 기본 스키마인 public으로 들어가기 때문에 해당 함수를 같은 DB에 다른 스키마에서 호출하면 동작하지 않았던 것이다.
create extension 확장패키지
3. 해결방법
기존에 설치된 확장패키지를 제거하고 스키마 지정 후 재설치를 설정하면 함수 인식이 정상적으로된다.
-- cascade 옵션을 안주면 의존성 때문에 삭제안됨 해당 옵션을 주면 earthdistance 까지 같이 삭제된다.
drop extension cube cascade
create extension cube with schema test
create extension earthdistance with schema test