Skip to content

fix(macos): fail a keyed save that matched no row on MySQL, SQL Server, Oracle, Snowflake and Dameng - #4242

Merged
datlechin merged 2 commits into
mainfrom
fix/d-rowcounts
Nov 12, 2026
Merged

datlechin merged 2 commits into
mainfrom
fix/d-rowcounts

Conversation

@datlechin

@datlechin datlechin commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

  • D-3: MySQL, MariaDB, TiDB and OceanBase sessions connect with CLIENT_FOUND_ROWS. An UPDATE counts the rows it matched, so a keyed edit that matched no row fails the save and rolls back. The editor's rows affected, ROW_COUNT() and MCP rows_affected count matched rows too; INSERT ... ON DUPLICATE KEY UPDATE onto a row holding the values reports 1, not 0.
  • D-4: PluginRowWrite.expectedRowCount (PluginKit, additive, kit stays 44). A driver sets it when its engine counts matched rows; the save then refuses a higher count, or a lower one for an UPDATE. It never raises the host's own one-row count.
  • SQL Server, Oracle, Snowflake and Dameng report 1 for each update and delete; Oracle's batched keyed delete reports its rows. SQL Server sends SET NOCOUNT OFF on keyed writes too, so a session left at SET NOCOUNT ON still reports the count (Preview SQL shows it).
  • A delete of a row already gone, a write through a view and an update after a delete in the same save stay lenient, as in fix(data-grid): keep edits through saves, undo and paste, hold keyed writes and restores to their rows #4226. Inspector saves now carry the view target, so a view edited there is treated like one edited in the grid.
  • Rust core (Linux, Windows): no change. sqlx-mysql 0.9.0 always sends FOUND_ROWS, every MySQL-family server measured offers it, and the core already holds keyed writes to exactly one row.
  • DataWriteRowCounts.areMeaningful is now countsMatchedRows; its two engine sets are now the same list.
  • New probes: scripts/probes/check-mysql-found-rows.sh, scripts/probes/check-mssql-keyed-row-counts.sh (builds the SQL Server plugin's own sources).
  • Test changed on purpose: DataWriteExecutorTests.fewerRowsIsNotAFailure pinned MySQL as lenient; it now uses an engine with no matched count, and the MySQL family joins keyedUpdateThatMatchedNothingFails.
  • Docs: docs(features): hold keyed edits to matched rows on MySQL, SQL Server, Oracle, Snowflake, Dameng docs#222

Test plan

  • New: PluginRowWriteTests, MySQLFoundRowsTests (the sign-in packet carries CLIENT_FOUND_ROWS), DataWriteExecutorTests (a driver count holds an update, leaves a gone row's delete and a view lenient), RowChangeStatementFactoryCoverageTests (the driver count reaches the plan and never raises the keyless one).
  • Measured with the shipped clients: MySQL 8.4.13, MariaDB 11.4.13, TiDB 8.5.1, OceanBase 4.4.2.1 (libmariadb 3.4.4); SQL Server 2022 CU14 (FreeTDS 1.4.22, through the plugin's code); Oracle 23ai (sqlplus); DM8 (disql). A same-value update counts 1, a miss 0, and trigger rows are not added.
  • iOS: app and tests build (build-for-testing); no simulator runtime on this Mac to run them.

Needs the maintainer

  • Snowflake was not measured (no account here). The hold reads the rows-updated column Snowflake returns; worth one check that an UPDATE writing the value a row holds reports 1.

@datlechin
datlechin enabled auto-merge (squash) November 12, 2026 18:54
@datlechin
datlechin merged commit b9927cd into main Nov 12, 2026
12 of 13 checks passed
@datlechin
datlechin deleted the fix/d-rowcounts branch November 12, 2026 21:36
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