Skip to content

Conversation

@Leesowon
Copy link
Collaborator

관련 이슈

📌 작업 개요

  • /api/v1/transporter/dispatch-list API에서 status 파라미터 미입력 시 발생하는 PostgreSQL 타입 추론 오류 수정
  • DispatchRepository.findDispatchesByDistance() Native Query 개선

문제점

  • status 파라미터가 null일 때 ERROR: could not determine data type of parameter $3 오류 발생
  • PostgreSQL이 IN (:statuses) 절에서 null 파라미터의 타입을 추론하지 못함

해결 방법

  • Native Query의 IN 절을 ANY 연산자로 변경
  • 명시적으로 CAST(:statuses AS text[]) 타입 캐스팅 추가
  • 변경 전: (:statuses IS NULL OR d.status IN (:statuses))
  • 변경 후: (CAST(:statuses AS text[]) IS NULL OR d.status = ANY(CAST(:statuses AS text[])))

✨ 기타 참고 사항

  • PostgreSQL Native Query 사용 시 null 파라미터에 대한 명시적 타입 캐스팅 필요
  • 동일한 패턴이 다른 Repository에도 있는지 확인 필요

✅ 체크리스트

  • PR 템플릿에 맞추어 작성했어요.
  • PR에 적절한 라벨을 선택했어요.
  • 변경 내용에 대한 테스트를 진행했어요.
  • application.yml 파일을 수정했다면, Notion에 업로드, github security 수정 및 공유했어요.
  • 로컬 서버에서 정상 동작을 확인했어요. (main, test)
  • 불필요한 코드는 삭제했어요.

테스트 시나리오:

1. status 파라미터 없이 요청 (전체 조회)

GET /api/v1/transporter/dispatch-list

2. status 파라미터 1개

GET /api/v1/transporter/dispatch-list?status=OPEN

3. status 파라미터 복수 개

GET /api/v1/transporter/dispatch-list?status=OPEN&status=HOLD

  - status 파라미터가 null일 때 'could not determine data type of parameter' 에러 발생
  - Native Query에서 명시적으로 text[] 타입 캐스팅 추가
  - IN 절을 ANY 연산자로 변경하여 PostgreSQL 호환성 개선
@Leesowon Leesowon self-assigned this Jan 22, 2026
@Leesowon Leesowon added the 🐞 Bug 뭐가 잘 안 돼요. label Jan 22, 2026
@Leesowon Leesowon merged commit c227f81 into dev Jan 22, 2026
1 check passed
@Leesowon Leesowon deleted the fix/#55 branch January 22, 2026 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 Bug 뭐가 잘 안 돼요.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants