Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the SQL documentation and release notes to detail the new SQL engine's behavior, specifically regarding case sensitivity, the new ESCAPE clause in LIKE pattern matching, and performance improvements that prevent backtracking. The review feedback suggests minor documentation improvements, such as avoiding the VersionBadge component mid-sentence inside tables, restructuring a section to place a list of rejected patterns immediately after its introductory sentence, and separating performance limitations from recommendations into distinct sentences for better readability.
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-786 This preview will update automatically when you push new commits. |
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-786 This preview will update automatically when you push new commits. |
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-786 This preview will update automatically when you push new commits. |
Adds a LIKE Pattern Matching section to the operations-API SQL reference for harper#3936 (v5.4): % and _ semantics, ESCAPE and its 400s, case sensitivity per engine and how auto can serve either, legacy-only character classes, and the per-value linear matching bound. Defines sql.engine and sql.allowFullScan in the fallback contract, lists LIKE among the engine behavior differences, and adds a 5.4 release note. Refs HarperFast/harper#3936 Dispatch-Task: docs-harper-3936 Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Name what keeps an unindexed LIKE on the new engine under auto: an indexed AND condition, ORDER BY on the primary key, allowFullScan. - Say the legacy engine checks a pattern when it tests a row. - Drop the claim that no pattern is expensive; both lengths multiply. - Scope the full-scan fallback list to auto with allowFullScan off, and note that pairing a suffix LIKE with an indexed condition makes it case-sensitive. Dispatch-Task: docs-harper-3936 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Point the scan-routing sentences at the fallback contract rather than enumerating which statements fall back, scan on the new engine, or get a 400, and scope eager pattern checks to statements the new engine plans. Dispatch-Task: docs-harper-3936 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Dispatch-Task: docs-harper-3936 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…length advice Dispatch-Task: docs-harper-3936 Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Document that _ matches any one character including line breaks on both SQL engines in v5.4.0. - Document the 10,000-character LIKE segment limit and its 400 error shape on both engines. - Document the legacy-engine 400 error when a pattern with more than 64 _ wildcards uses a character from every reserved noncharacter and Private Use Area pair. - Clarify escaped [ on the legacy engine and literal pattern checking under auto. Dispatch-Task: documentation-786-like-rules-update Co-Authored-By: Gemini <[email protected]>
Dispatch-Task: documentation-786-like-rules-update Dispatch-Task: pr-maint-53d171c3888f7402736f60bbd9a4d118 Co-Authored-By: Gemini <[email protected]>
e2509bd to
0fc2fb7
Compare
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-786 This preview will update automatically when you push new commits. |
⊙ Problem
The SQL reference describes
LIKEonly as "Searches for a pattern". harper#3936 makesESCAPEwork and stops matching from backtracking in v5.4. No page says what a pattern means. Also undocumented: the new engine matches case-sensitively and the legacy engine does not. Under the defaultsql.engine: auto, the sameLIKEcan match different rows depending on indexes.🤔 Is the requirement right?
Yes. The brief asks for the v5.4 matching rules. The case split is the part most likely to change which rows an
UPDATEorDELETEtouches, so it gets the most space.💡 Solution
%and_matching line breaks on both engines), literal characters,ESCAPEand its 400 errors, case sensitivity per engine, legacy-only[...]classes, and matching cost and pattern limits. Review the case section most closely: it says which statementsautoruns on which engine.LIKEjoins the behavior changes from the legacy engine: adding or dropping an index can change which rows it matches.sql.engineandsql.allowFullScan.🤔 Define sql.engine and sql.allowFullScan on the SQL page?
Yes, in two short paragraphs, because
LIKEdepends on them and no page defines them. A fullsqlentry in the configuration options page also needsmaxSortRowsandmaxHashRows, which I did not check. It is tracked in #785.⚖️ Alternatives
🔧 Changes
reference/operations-api/sql.md: the new LIKE section linked from the operators table, a LIKE bullet in the engine behavior changes,sql.engine/sql.allowFullScanin the fallback contract, and edits to the 5.2 callout, the Query Performance intro, the fallback list and the suffixLIKEbullet. Updated forharper#3936at48d0e92:_matches line breaks on both engines, the 10,000-character segment limit and its 400 error JSON, the legacy >64-_reserved noncharacter / Private Use Area pair 400 error JSON, escaped[on the legacy engine, and literal-pattern checking before fallback underauto.release-notes/v5-lincoln/5.4.md: a## SQLentry with the upgrade impact, including_matching line breaks on both engines and both new 400 rejections.✅ Verification
harper#3936(48d0e92)DESIGN.md,sqlEngine/expressions/like.ts,sqlTranslator/alasqlLike.ts, and integration/unit tests, plus a scratch Harper build underauto,new,newwithallowFullScan, andlegacy.[email protected]. On the new engine,ESCAPEwas ignored,*acted as a quantifier, and%and_skipped line breaks. On the legacy engine,_skipped line breaks and'a\d'matcheda5.npm run buildpasses, including links and anchors. So doformat:check,lint,typecheckandtest:examples.Selected results (PR head, sql.engine: auto unless noted)
ip LIKE 't0!%' ESCAPE '!'t0%onlyip LIKE 't0%'(indexed, new engine)t0%,t0!z,t0a; notT0bnote LIKE 't0%'(unindexed, falls back)T0bnote LIKE 't0%' ORDER BY idT0bip LIKE '%T0B'T0bDELETE ... WHERE ip LIKE 't0%'T0bnote LIKE 'a_b'a\nbanda\rbon both enginesnote LIKE '[z-a]%'ESCAPE '!!',ESCAPE '',ESCAPE 1, trailing escape%wildcards_pattern naming every noncharacter and PUA pairnote LIKE '%_%_%_%_%_%_%_%_%_%_%_%_%_%_Z'on a 100 KB valuesql.engine: new,note LIKE 't0%'🤔 Merge after harper#3936?
Yes.
harper#3936merged tomain(ef427ad), and no 5.4 release tag includes it yet, so thev5.4.0badges match the next release.Refs HarperFast/harper#3936
🤖 Generated by Gemini (gemini-4-argon-high); posted via @kriszyp.
Related PRs: #783 overlaps, #788 overlaps
Complexity: medium
Deferred findings
d2d3f81fc83e88c1minor documentation —release-notes/v5-lincoln/5.4.md— harper#3936 release status unverified; SQL entry lacks 'not released yet' line unlike sibling sections — NOT FILED1fb37cf7647bc110minor documentation —reference/configuration/options.md— No sql section in configuration options for sql.engine / allowFullScan / HARPER_SQL_ENGINE — filed Document the sql configuration block (engine, allowFullScan, maxSortRows, maxHashRows) in configuration options #7856960e19497514b0bminor documentation —reference/operations-api/sql.md— 'no rows are changed' unverified for expression patterns checked per row in UPDATE/DELETE — NOT FILED426309ddbbac72bdnit documentation —reference/operations-api/sql.md— Open PR Assemble the v5 reference and open release notes from harper and harper-pro #788 also edits sql.md; the merge order can restore 'results don't change' — NOT FILEDOrigin — the dispatch brief this PR was written from
Document SQL LIKE wildcards, ESCAPE, and case sensitivity (harper#3936)
Document SQL
LIKEsemantics in the operations-API SQL reference (reference/operations-api/sql.md, which today listsLIKEonly as "Searches for a pattern"), following HarperFast/harper PR HarperFast/harper#3936 (milestone v5.4).What to document, as user-facing behavior:
%matches any run of characters, including line breaks;_matches exactly one character other than a line break (\n,\r, U+2028, U+2029).LIKE pattern ESCAPE 'c': the escape character makes the next character literal (for exampleip LIKE 't0!%' ESCAPE '!'matches exactlyt0%). The escape must be exactly one character. A pattern ending in the escape character, an empty or multi-character ESCAPE, and a non-string ESCAPE are rejected with a 400. ESCAPE works in SELECT, UPDATE and DELETE.sql.engine: new(and statementsautoserves with the new engine) LIKE is case-sensitive; the legacy engine (sql.engine: legacy, andautofallbacks) is case-insensitive. Say this plainly; a user runningautocan see either.[abc],[a-z]and[^abc]character classes; a reversed range such as[z-a]is a 400. Characters such as*,\,^,$are literals in patterns on both engines.sql.allowFullScanor fall back to the legacy engine underauto(link the existing sql.engine docs if present).Version note: these are v5.4 behaviors; earlier versions ignored ESCAPE in the new engine and treated
*as a wildcard-like regex quantifier there.Dispatch: task
docs-harper-3936· queued by task:harper-sql-like-linear-matcher-escape · ran by claude/opus/xhigh · worker kzyp-xps-1Review-Coverage: authored=gemini; ran=cursor-composer,codex,claude; adjudicated=domain; declined=cursor-grok,muse; rounds=8; full=1 @ 0fc2fb7
Review-Attention: skim ~2m (decisions: document-vs-unify-like-case, edge-case-depth, config-keys-home) @ 0fc2fb7