Skip to content

fix(Postgres): escape apostrophes in JSON path segments - #271

Merged
roxblnfk merged 2 commits into
2.xfrom
fix/postgres-json-path-quotes
Sep 27, 2026
Merged

roxblnfk merged 2 commits into
2.xfrom
fix/postgres-json-path-quotes

Conversation

@roxblnfk

Copy link
Copy Markdown
Member

🔍 What was changed

  • Postgres JSON path segments are now escaped: apostrophes inside a key are doubled before the segment is wrapped into an SQL string literal.
  • Affects every Postgres JSON condition: whereJson, whereJsonContains, whereJsonDoesntContain, whereJsonContainsKey, whereJsonDoesntContainKey, whereJsonLength and their or* variants.

Why?

A key with an apostrophe (e.g. data->it's) broke the generated SQL on Postgres, while the other drivers already escape it.

Checklist

  • How was this tested:
    • Functional tests added
    • Postgres driver suite run locally against Postgres from tests/docker-compose.yml

The Postgres JSON compilers quote path segments without escaping apostrophes, so such keys break the generated SQL. The tests fail until the compiler is fixed.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.66%. Comparing base (166c6ea) to head (56ce86f).

Additional details and impacted files
@@            Coverage Diff            @@
##                2.x     #271   +/-   ##
=========================================
  Coverage     95.66%   95.66%           
  Complexity     2230     2230           
=========================================
  Files           142      142           
  Lines          6341     6341           
=========================================
  Hits           6066     6066           
  Misses          275      275           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@roxblnfk
roxblnfk merged commit da09e24 into 2.x Sep 27, 2026
31 checks passed
@roxblnfk
roxblnfk deleted the fix/postgres-json-path-quotes branch September 27, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant