Skip to content

fix(plugins): version-gate SQL across Cassandra, MongoDB, ClickHouse, MSSQL, MySQL#1242

Merged
datlechin merged 2 commits into
mainfrom
fix/all-driver-version-compat
May 13, 2026
Merged

fix(plugins): version-gate SQL across Cassandra, MongoDB, ClickHouse, MSSQL, MySQL#1242
datlechin merged 2 commits into
mainfrom
fix/all-driver-version-compat

Conversation

@datlechin
Copy link
Copy Markdown
Member

Summary

Mirrors PR #1241 (PostgreSQL) for the other driver plugins. Each affected plugin gets a small *Capabilities struct keyed off the connection's reported server version, with version-gated SQL routed through it. Same shape across plugins — greppable, documents minimum supported version inline.

Changes

Plugin Site Fix
Cassandra CassandraPlugin.swift:connect() Throw clear error on Cassandra <3.0 (no system_schema keyspace). Six downstream system_schema.* queries previously crashed with cryptic "table not found" during sidebar load.
MongoDB MongoDBConnection.swift:listDatabasesSync Drop nameOnly: true flag for servers <3.4 which don't accept it.
ClickHouse ClickHousePlugin.swift:fetchIndexes Skip system.data_skipping_indices query on <19.17.
MSSQL MSSQLPlugin.swift:createViewTemplate + editViewFallbackTemplate Use CREATE OR ALTER VIEW only on SQL Server 2016+ (major ≥13). Older versions get IF EXISTS DROP / CREATE VIEW.
MySQL MySQLPlugin.swift:explainVariants Add a plain EXPLAIN variant alongside EXPLAIN FORMAT=JSON (5.6.5+). User can pick.

Why these and not others

The full audit (6 parallel agents) flagged 14 candidate sites across 14 plugins. Five of those were false positives or not worth gating:

  • MySQL COLLATION_CHARACTER_SET_APPLICABILITY — auditor was wrong; this view has been in MySQL since 5.0.
  • DuckDB information_schema / duckdb_indexes — only affects DuckDB <0.9. Effectively no users in 2026.
  • SQLite ALTER TABLE … RENAME/DROP COLUMN — TablePro bundles its own libsqlite via scripts/download-libs.sh. Bundled version is modern.
  • Oracle diagnostic text — re-reading, the two diagnostics (authVerifierUnsupported for password-format-on-account, vs authVersionNotSupported for server-version) are correctly distinguishing two different error categories. Easy to misread but technically correct.
  • CloudflareD1 PRAGMA functions — D1 ships modern SQLite (3.40+), all pragma_*() table-valued functions present (3.16+).

Architecture

Each plugin gets a sibling file:

struct CassandraCapabilities: Sendable, Equatable {
    let releaseVersionMajor: Int
    var hasSystemSchemaKeyspace: Bool { releaseVersionMajor >= 3 }
    static func parseMajorVersion(_ version: String?) -> Int {  }
}

struct MongoDBCapabilities: Sendable, Equatable {
    let major: Int
    let minor: Int
    var supportsListDatabasesNameOnly: Bool { major > 3 || (major == 3 && minor >= 4) }
}

struct ClickHouseCapabilities: Sendable, Equatable {
    let major: Int
    let minor: Int
    var hasDataSkippingIndicesTable: Bool { major > 19 || (major == 19 && minor >= 17) }
}

struct MSSQLCapabilities: Sendable, Equatable {
    let major: Int
    var hasCreateOrAlterView: Bool { major >= 13 }
}

Same shape as PostgreSQLCapabilities from PR #1241. Each flag documents its minimum version inline next to the comparison.

Test plan

  • Connect to Cassandra 3.x or 4.x — works as before.
  • Connect to Cassandra 2.x (if available) — fast clear error message.
  • Connect to MongoDB ≥4.0 — works as before.
  • Connect to MongoDB 3.0/3.2 — listDatabases succeeds (was failing on nameOnly flag).
  • ClickHouse modern (≥20) — index sidebar populates as before.
  • ClickHouse <19.17 — index sidebar shows base indexes only, no error.
  • MSSQL 2019+ — view edit template uses CREATE OR ALTER.
  • MSSQL 2014 or earlier — view edit template uses IF EXISTS DROP / CREATE.
  • MySQL: Explain dropdown shows two options now (EXPLAIN and EXPLAIN (JSON)).

Notes

Bundled plugins ship with the next app release. No registry republish per feedback_no_registry_for_builtins. Cassandra/MongoDB/MSSQL are registry plugins — they'll need the standard re-tag + plugins.json bump after merge.

@datlechin datlechin merged commit 74eb1c9 into main May 13, 2026
2 checks passed
@datlechin datlechin deleted the fix/all-driver-version-compat branch May 13, 2026 01:52
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.

1 participant