Skip to content

feat(datagrid): add case sensitivity to data grid filters - #2052

Merged
datlechin merged 2 commits into
mainfrom
fix/2048-filter-case-sensitivity
Aug 9, 2026
Merged

datlechin merged 2 commits into
mainfrom
fix/2048-filter-case-sensitivity

Conversation

@datlechin

Copy link
Copy Markdown
Member

Closes #2048.

The problem

Case sensitivity had no representation anywhere: not in TableFilter, not in FilterSQLGenerator, and not in the (column, op, value) tuple that crosses into plugins. Case-sensitive contains on DuckDB is one visible instance of that missing dimension.

The gap was masked in opposite directions, which is why it read as a bug rather than a missing feature. MySQL, SQLite and SQL Server looked correct because their default collation already folds case. MongoDB, Elasticsearch, DynamoDB and etcd looked correct because they hardcoded i-mode with no way to turn it off. PostgreSQL, DuckDB, Oracle and BigQuery were simply where the absence showed.

What changed

TableFilter gains isCaseSensitive, modelled on NSComparisonPredicate.Options.caseInsensitive and the [c] predicate-format modifier rather than doubling the operator enum. The operator dropdown stays at 18 entries.

Contains, not contains, starts with and ends with ignore case. Equals, not equals, IN, NOT IN and regex match case. Both are per row, and the setting lives in the operator menu under a divider, so picking an operator is still two clicks and the row gains no width. A row that departs from its operator's usual setting shows an Aa icon on the button, so the common case looks exactly as it does today.

SQLDialectDescriptor gains a caseSensitivityStyle that decides what each engine emits:

Style Engines Ignore-case emits
ilikeOperator PostgreSQL, CockroachDB, PGlite, DuckDB, Snowflake ILIKE for the LIKE family, LOWER() for equals/IN
caseFoldFunction Oracle, BigQuery, ClickHouse (lowerUTF8), Redshift LOWER(col) LIKE LOWER(pat)
regexFlag Trino regexp_like(col, pat, 'i'), anchored per operator
driverManaged MongoDB, Elasticsearch, DynamoDB, etcd the driver's own mechanism
collationDefined MySQL, MariaDB, SQL Server, SQLite, libSQL, Turso, D1 today's SQL; control disabled
unsupported Cassandra, ScyllaDB, Redis, any stale plugin binary today's SQL; control disabled

Two calls worth flagging:

  • Redshift and ClickHouse get caseFoldFunction, not ilikeOperator, even though both have ILIKE. AWS documents Redshift's ILIKE as folding single-byte ASCII only and tells you to use LOWER for multibyte; ClickHouse folds by English rules on single-byte assumptions. Using their native operator would be silently wrong on non-ASCII data.
  • collationDefined, not "always case-insensitive". TablePro cannot observe a column's collation, so claiming SQL Server always ignores case would be false on a _CS_AS database or a MySQL _bin column. The disabled control's tooltip says case sensitivity follows the column's collation, which is true.

ABI

SQLDialectDescriptor's single public init is called by every shipped registry plugin binary, so it gained a new overload with @_disfavoredOverload on the existing one, per the 0.49.0 columnMeta: lesson. Same technique for a new buildFilteredQuery / fetchFilteredRowCount / fetchExactRowCount overload taking a new PluginQueryFilter struct; the default implementations forward to the existing tuple versions, so an un-updated plugin returns exactly the SQL it returns today rather than dropping the filter.

Verified by building TableProPluginKit at main and at this branch and diffing exported symbols: 0 removed, 79 added. scripts/check-pluginkit-abi.sh reports the diff, and every line in it is an addition apart from the old initializer, which reappears with an identical signature (@_disfavoredOverload does not change mangling). No currentPluginKitVersion bump and no plugin re-release needed.

A stale registry plugin reports unsupported and keeps today's behaviour. To avoid making users wait for a plugin release, PluginMetadataRegistry.adoptCuratedCaseSensitivity lets the app's curated entry fill that gap for engines it already knows, the same shape as the existing withSwitchRouting fallback. So DuckDB users get ILIKE on the next app build, without updating the DuckDB plugin.

Behaviour change to be aware of

The new default applies to filters already saved to disk, so a saved contains filter now ignores case on PostgreSQL, DuckDB, ClickHouse, Snowflake, Redshift, CockroachDB, Oracle, BigQuery and Trino. That is the point of the change, and it is what makes those engines agree with MySQL, SQLite and MongoDB, but it is a change on upgrade rather than only a new feature. Match Case restores the old behaviour per row. MySQL, SQLite, SQL Server and the document stores see no change at all.

One adjacent fix included

BigQuery's dialect declared likeEscapeStyle: .explicit, so the exact-row-count path emitted LIKE '%x%' ESCAPE '!'. BigQuery has no ESCAPE clause, so that count query was a syntax error. It is a one-line correction inside the function this change rewrites, and shipping the new feature on top of it would have shipped it broken. Left out as separate issues: SQL Server not escaping [ / [^ in LIKE patterns, and MySQL under NO_BACKSLASH_ESCAPES. Neither is touched by this change.

Tests

291 passing across the affected suites, including:

  • a dialect x operator matrix over FilterSQLGenerator covering ILIKE, fold, regex-flag, collation-defined and unsupported engines
  • legacy JSON with no case key decoding to the per-operator default, and a preset batch surviving a mix of old and new rows
  • a guard that the pre-existing SQLDialectDescriptor initializer still yields unsupported, which is what keeps stale plugins safe
  • MongoDB, Elasticsearch, DynamoDB, etcd and BigQuery builders in both directions
  • a numeric column never getting a fold function wrapped around it, which would be a type error on strict engines
  • the mobile generator mirrored in TableProQueryTests

No TableProUITests coverage: the filter panel needs a live connection and an open table tab, which the existing UI tests do not set up and which would not run deterministically in CI. The presentation rules were extracted into FilterCaseSensitivityPresentation, a pure type, and unit-tested instead.

Verified

  • macOS app builds; TablePro Mobile builds for the arm64 simulator slice
  • swiftlint lint --strict clean across 1285 files
  • PluginKit ABI symbol diff clean, as above

@mintlify

mintlify Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
TablePro 🟢 Ready View Preview Aug 9, 2026, 1:49 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@datlechin
datlechin merged commit c81bf23 into main Aug 9, 2026
5 checks passed
@datlechin
datlechin deleted the fix/2048-filter-case-sensitivity branch August 9, 2026 14:29
datlechin added a commit that referenced this pull request Aug 9, 2026
* feat(datagrid): add case sensitivity to data grid filters

* fix(plugins): keep case sensitivity separate from what a backend supports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for ILIKE operator in filters

1 participant