You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ClickHouse: macOS grid saves send plain UPDATE and DELETE keyed on the sorting key #3776
Found while fixing #3765. On macOS, a data grid save on a ClickHouse table never reaches the plugin's ALTER TABLE … UPDATE and ALTER TABLE … DELETE.
MainContentCoordinator.setupPluginDriver gives the change manager queryBuildingPluginDriver, which is nil for a driver that does not build its own browse query (PluginDriverAdapter.swift:61). ClickHouse, Dameng, Snowflake and Trino write their own rows but build no browse query, so their generateRowWrites never runs on macOS.
The save then goes through SQLStatementGenerator: UPDATE t SET … WHERE <pk> = ? and DELETE FROM t WHERE <pk> = ?.
On ClickHouse 25.8 the UPDATE fails with Code 48 on a MergeTree table without lightweight updates.
The DELETE runs as a lightweight delete keyed on the columns flagged as primary key. ClickHouse's primary key is the sorting key prefix and is not unique, so deleting one row deletes every row that shares it. ClickHouse reports written_rows 0, so DataWriteExecutor cannot catch it.
The docs say grid edits use the ALTER forms (databases/clickhouse.mdx, Running queries).
The iOS app routes ClickHouse writes through the plugin and pins each one to its row: it matches every column, refuses identical rows, adds AND _part = ? and waits with SETTINGS mutations_sync = 1 (IOSDriverFactory.swift:186, PluginBackedDriver.swift:307).
Steps to reproduce
Read from the code path and the server's answers to the same statements, not run in the app.
CREATE TABLE t (d Date, id UInt32, v String) ENGINE = MergeTree ORDER BY d, insert two rows with the same d.
Open t in the grid, delete one row and save: both rows are gone.
Edit a cell and save: Code 48.
Expected behavior
A grid edit or delete changes only the row it was made on, through the plugin's statements, and returns once applied. Snowflake, Dameng and Trino saves use their own row writers too.
Activity