fix(editor): normalize smart quotes in table filter and sort clauses#439
Open
Davydhh wants to merge 2 commits into
Open
fix(editor): normalize smart quotes in table filter and sort clauses#439Davydhh wants to merge 2 commits into
Davydhh wants to merge 2 commits into
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Reviewed by kimi-k2.6 · Input: 56.5K · Output: 5.5K · Cached: 36.7K |
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.
Problem
Loading the row count for a table whose filter contains a quoted string value
failed with
ERROR: unterminated quoted string, so the count stayed stuck onthe
#button. Filters with only numeric comparisons worked fine.Root cause
macOS "Smart Quotes" rewrites a typed
'into a curly‘/’(U+2018/U+2019)in the toolbar's WHERE/ORDER BY inputs. SQL only treats a straight
'as astring delimiter, so a clause like
col = 'value'reached the database ascol = ‘value’: the curly char is an ordinary character and the leftoverstraight quote opened a string that never closed. The count query —
SELECT COUNT(*) FROM (…) as count_wrapper— then failed to parse. The gridquery ran before macOS finalized the conversion, which is why only the count
broke.
Fix
Fold typographic quotes back to straight ASCII inside
reconstructTableQuery—the single builder every table query (grid and count) flows through — so the
SQL that reaches the database is always valid, regardless of what's stored. This
also fixes it for a filter that was already stored with a curly quote, without
needing to re-apply it.
Testing
reconstructTableQuerytest: a curly-quote filter reconstructs tostraight quotes.
tsc --noEmitclean; editor util tests pass.