DataBase
PostgreSQL SQL Error [42725]: ERROR: function date_trunc(unknown, unknown) is not unique Hint: Could not choose a best candidate function. You might need to add explicit type casts.
맑은안개
2023. 2. 5. 20:52
문제의 쿼리
SELECT date_trunc('month', '2022-07-23 12:34:56');
실행 시 아래 오류 발생
SQL Error [42725]: ERROR: function date_trunc(unknown, unknown) is not unique
Hint: Could not choose a best candidate function. You might need to add explicit type casts.
- 위 Hint에서 처럼 입력한 파라미터가 unknown으로 인식된다. 아래와 같이 캐스팅하여 문제를 해결한다.
SELECT date_trunc('month'::text, '2022-07-23 12:34:56'::timestamp);
반응형