pg.ddx.io  psycopg/psycopg GitHub issues and pull requests  
help / color / mirror / Atom feed
From: anish-yen (@anish-yen) <noreply+anish-yen@github.com>
To: psycopg/psycopg <noreply+psycopg-psycopg@github.com>
Subject: Re: [psycopg/psycopg] PR #1505: Decode JSON data using the connection encoding
Date: Thu, 19 Nov 2026 20:54:43 +0000
Message-ID: <gh-psycopg-psycopg-1505-c7021961603@github.com> (raw)
In-Reply-To: <gh-psycopg-psycopg-1505@github.com>
References: <gh-psycopg-psycopg-1505@github.com>

Both done, thank you for the quick look.

- Added a changelog entry under a new "Psycopg 3.3.10 (unreleased)" section.
- Added `test_load_ascii_encoding`: creates a table, inserts a JSON value with a non-ASCII char with the connection in UTF-8, switches to `sql_ascii`, and reads it back, for `json`/`jsonb` in both text and binary format.

On the SQL_ASCII behavior: with no recoding, the server sends the stored bytes unchanged, so data written as UTF-8 arrives as valid UTF-8 and `json.loads()` parses it through its own auto-detection. The loader keeps the bytes fast path for `ascii`, mirroring how `TextLoader` treats it as "encoding unknown". On a database whose stored bytes are not UTF-8 the parse would fail the same way it did before this change; with SQL_ASCII the genuine encoding is unknowable to the client, so passing the bytes through seems the best available behavior.

view thread (10+ messages)  latest in thread

Message-ID: <gh-psycopg-psycopg-1505-c7021961603@github.com>
Permalink:  ../gh-psycopg-psycopg-1505-c7021961603@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox