pgx icon indicating copy to clipboard operation
pgx copied to clipboard

simple protocol queries must be run with client_encoding=UTF8

Open gongxulei opened this issue 1 year ago • 1 comments

Describe the bug it's not work when pg server param "server_encoding " != utf8.

To Reproduce Steps to reproduce the behavior:

If possible, please provide runnable example such as:


Please run your example with the race detector enabled. For example, go run -race main.go or go test -race.

Expected behavior A clear and concise description of what you expected to happen.

Actual behavior A clear and concise description of what actually happened.

Version

  • Go: $ go version -> [e.g. go version go1.18.3 darwin/amd64]
  • PostgreSQL: $ psql --no-psqlrc --tuples-only -c 'select version()' -> [e.g. PostgreSQL 14.4 on x86_64-apple-darwin21.5.0, compiled by Apple clang version 13.1.6 (clang-1316.0.21.2.5), 64-bit]
  • pgx: $ grep 'github.com/jackc/pgx/v[0-9]' go.mod -> [e.g. v4.16.1]

Additional context Add any other context about the problem here.

gongxulei avatar Nov 22 '24 03:11 gongxulei

This restriction is due to the difficulty of safely interpolating parameters into the query string when different encodings are used.

While in theory I am not opposed to lifting this restriction, in practice any such change would need to meet an extremely high bar to show it was secure.

jackc avatar Nov 27 '24 15:11 jackc