문제 발생 상황
로컬 DB에 있는 데이터를 원격 DB로 옮기는 과정에서 다음 오류가 발생했다.
[2026-02-25 14:22:49] [XX000]
[2026-02-25 14:22:49] Batch entry 3 INSERT INTO public.legal_address (id, code, created_at, updated_at, address_initials, eupmyeondong, li, sido, sigungu, center_point, full_address, polygon, latitude, longitude, region_address_level, geohash) VALUES (5908, '4180036030', null, null, '경연신신', '신서면', '신현리', '경기도', '연천군', '0101000020E6100000DBE1BBFD42C25F404F8F0A71181D4340', '경기도 연천군 신서면 신현리',
…
, 38.22730839744201, 127.03533881519199, 'DL', 'wyf36z') was aborted: ERROR: WKB structure does not match expected size!
[2026-02-25 14:22:49] Position: 358 Call getNextException to see other errors in the batch.
[2026-02-25 14:22:49] [XX000] ERROR: WKB structure does not match expected size!
[2026-02-25 14:22:49] Position: 358
1. Datagrip을 이용해 원본 테이블에서 insert문을 추출 -> .sql 파일 생성
2. 클린한 새로운 테이블에서 run
3. 몇몇 데이터 삽입 시 언급한 오류 발생
해결
- .sql파일 실행 시 문제가 있었던 데이터를 하나씩 수동 copy 후 insert하는 경우 성공적으로 작업이 완료되는 것을 발견했다.
따라서 추출 과정에 문제가 발생했음을 짐작하고, pg_dump를 이용해 데이터 추출 작업을 진행했다.
- pg_dump를 이용해 export한 dump file을 원격 DB에서 psql로 restore했다.