Repository navigation
Conversation
Plex's SOCI backend reads every integer column through sqlite3_column_text() and parses the string, so any deviation from SQLite's text output changes the parsed value. - PostgreSQL booleans arrive as "t"/"f"; SQLite yields 1/0 (e.g. SELECT EXISTS(...)). Plex parsed "t" as 0, so every category existence check was false and Library Categories returned 0 entries. The text transform now maps OID 16 t/f to 1/0. - max()/min() of a BIGINT column was rendered as a datetime string whenever the SQL contained "_at" anywhere (e.g. originally_available_at). Plex parsed "2026-11-18 ..." as the number 2026 and the On Deck history query dropped every show. These aggregates now stay plain digits, and the unused pg_sql_has_timestamp_hint is removed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BhzRzGrcQsh5xuVFKYGNNg
rogly
marked this pull request as ready for review
November 19, 2026 02:55
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Potential fix for #92.
Summary
After migrating Plex 1.43.5 from SQLite to PostgreSQL, two things broke:
Both come from
sqlite3_column_text()returning something different from what SQLite returns. Plex's SOCI backend reads every integer column through that accessor and parses the string (see the v0.8.12 CHANGELOG notes), so any deviation silently changes the parsed value.Causes and fixes
1. Booleans came back as
t/ft/fforSELECT EXISTS(...). SQLite returns1/0.tas 0, so every category-existence check was false.rust_column_text_transformnow maps OID 16t/fto1/0.2.
max(viewed_at)was rendered as a datetime stringmax/minBIGINT asYYYY-MM-DD HH:MM:SSwhenever the SQL contained_atanywhere, for exampleoriginally_available_atin a join.2026-11-18 ...as the number 2026, so the On Deck history query dropped every show.max/minof integer columns stay decimal. This removes the datetime branch and the now-unusedpg_sql_has_timestamp_hint.Verification
Tested on a live Plex 1.43.5 instance in Kubernetes, with the shim overlaid on the production image:
/library/sections/1/categories/hubs/continueWatchingUnit tests were added for the bool conversion, for leaving non-bool
t/falone, and formax()of an epoch staying decimal. I could not link the test binary in my build environment, so they have not been run locally. CI is the first real run.Notes for review
column_textdeviations. I only found these two.🤖 Generated with Claude Code