Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple protocol queries must be run with client_encoding=UTF8 #2174

Open
gongxulei opened this issue Nov 22, 2024 · 1 comment
Open

simple protocol queries must be run with client_encoding=UTF8 #2174

gongxulei opened this issue Nov 22, 2024 · 1 comment
Labels

Comments

@gongxulei
Copy link

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 gongxulei added the bug label Nov 22, 2024
@jackc
Copy link
Owner

jackc commented Nov 27, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants