본문으로 건너뛰기

client_encoding

버전기본값context타입
14to use the database encodinguserstring
15to use the database encodinguserstring
16to use the database encodinguserstring
17to use the database encodinguserstring
18to use the database encodinguserstring
19to use the database encodinguserstring

client 쪽에서 사용할 encoding(문자 집합)을 정한다. 기본값은 데이터베이스 encoding을 그대로 쓰는 것이다.

데이터베이스 encoding과 다른 값으로 설정하면 서버가 두 encoding 사이에서 문자를 자동 변환해 준다. 실제로는 파라미터를 직접 만지기보다 client 라이브러리가 접속 시점에 알아서 설정하는 경우가 많다. 예를 들어 psql은 OS locale에 맞춰, 각 언어의 driver는 자체 규칙에 따라 이 값을 정한다.

운영 노트: 데이터베이스 encoding이 UTF8이라면 client encoding도 UTF8로 통일하는 것이 가장 탈이 없다. 변환이 불가능한 문자가 섞이면 쿼리가 encoding 변환 오류로 실패할 수 있다.

출처: PostgreSQL 18 문서