sqlfmt: omit generated columns from diff -r sql - #11476
Conversation
dolt diff -r sql was emitting STORED generated columns in INSERT and UPDATE statements, which the engine rejects on replay. Populate Column.Generated and Virtual in schemaFromCreateTableStmt so IsGenerated works on the CLI SQL-diff path, and skip generated columns in SqlRowAsUpdateStmt / GenerateDataDiffStatement (mirroring the existing INSERT filters). Fixes dolthub#11445
|
@vishnujayvel Could you shorten the description to be similar to our teams' release notes? They come up as release notes and this change is relatively small. |
|
Done — shortened the description to match the team's release-note style. Thanks again for the repro in #11445 — it named both failure points, which is why this landed as a small diff. I've parked the long-form root cause and test plan below so it stays on the PR for review without ending up in the release notes. Original description (root cause + test plan)
The same emission path backs the Fixes #11445 Thanks to @elianddb (Elian) for the clear repro and for tracing both failure GotUPDATE `t` SET `a`=99,`g`=100 WHERE `id`=1;
INSERT INTO `t` (`id`,`a`,`g`) VALUES (2,20,21);Want / after this changeUPDATE `t` SET `a`=99 WHERE `id`=1;
INSERT INTO `t` (`id`,`a`) VALUES (2,20);Root cause (two parts)
Fix
Test plan
Notes
|
dolt diff -r sqlno longer assigns generated columns in theINSERTandUPDATEstatements it emits, so its output can be replayed. Previously the engine rejected those assignments; where the diff is emitted asDELETE+INSERT— keyless tables, and tables whose primary key is itself generated — replay deleted the old row and then failed to reinsert it, silently losing the row.dolt_patch()'sstatementoutput is fixed by the same change.schemaFromCreateTableStmtnow populatesGenerated,Virtual, andOnUpdateonschema.Column, soIsGenerated()is correct for schemas built fromSHOW CREATE TABLE.SqlRowAsUpdateStmtskips generated columns, andGenerateDataDiffStatementdrops them fromcolsToUpdate.Fix #11445