Skip to content

ClickHouse: macOS grid saves send plain UPDATE and DELETE keyed on the sorting key #3776

Closed

Description

@datlechin

What happened?

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.

  1. CREATE TABLE t (d Date, id UInt32, v String) ENGINE = MergeTree ORDER BY d, insert two rows with the same d.
  2. Open t in the grid, delete one row and save: both rows are gone.
  3. 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.

Database type

ClickHouse

Platform

macOS

Activity

  1. added
    bug
    platform-macos
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugplatform-macos

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions