mirror of
https://github.com/element-hq/synapse.git
synced 2026-08-16 02:30:26 +00:00
Reading a `json`/`jsonb` column failed with "error deserializing column" — the value mapping had no decoder for them. Synapse reads genuine `jsonb` values, most visibly for custom profile fields (`get_profile_field` selects `JSONB_EXTRACT_PATH(fields, ?)`), so those requests returned HTTP 500 on the Rust backend. Decode `json`/`jsonb` into the matching Python object (dict/list/scalar), as psycopg2 does by default: `json` is the raw JSON text, `jsonb` a one-byte version header (currently 1) then the text; parse with serde_json and convert via pythonize. `PythonPgFromSql::accepts` now also accepts `json`/`jsonb`; the Rust-native `DbValue` decoder stays scalar-only (nothing reads json through it). Fixes the profile custom-field 500s (e.g. test_non_string, test_can_lookup_own_profile) on the Rust backend. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W3G4M92AmwSSZCbmtMJU3d