Skip to content

fix(grid): clear primary key columns when duplicating a row in staging buffer (#888) - #962

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/888-duplicate-row-clear-pk
Sep 25, 2026
Merged

ZhuchkaTriplesix merged 1 commit into
devfrom
issue/888-duplicate-row-clear-pk

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Описание изменений

  • DataGridStagingBuffer принимает primaryKeys и получил duplicateRow(index): копирует строку (базовую или уже вставленную) в новую вставляемую, очищая ячейки PK. Имена сравниваются без учёта регистра и кавычек, составные ключи очищаются целиком. Staged NULL копируется как NULL.
  • VirtualResultGrid._handleDuplicateRow вызывает duplicateRow с индексом модели (учитывает сортировку).
  • PK прокинуты во все места создания буфера: table view (PG/MySQL/SQLite/extension) через replaceTableViewStagingBuffer(primaryKeys:) и SQL workspaces.
  • Пустое PK-значение движок пропускает при INSERT, если у колонки есть default или она nullable (serial, AUTO_INCREMENT и т.п.), и БД генерирует ключ. Натуральные ключи пользователь дозаполняет вручную (по scope issue).
  • Тесты: data_grid_staging_buffer_test (одиночный и составной PK, NULL, дубль вставленной строки, без PK, неверный индекс).

Связанные Issue

Closes #888

Тесты локально не запускались (есть CI), dart analyze чистый.

…g buffer (Closes #888)

Duplicate Row cloned every cell verbatim, so the staged INSERT carried the
original primary key and Save failed with a unique constraint violation.

Add DataGridStagingBuffer.duplicateRow, which blanks primary key cells (matched
case-insensitively and ignoring identifier quoting) so the engine can omit
them and let the database generate the key. The buffer now receives the table
primary keys from the Table Browser views and SQL workspaces, and the grid
delegates Duplicate Row to it.
@github-actions github-actions Bot added bug Something isn't working frontend Theme parser epic label: frontend data-grid Interactive data grid, cell editor, filtering, groupings ux User experience, keyboard shortcuts and interactions labels Sep 25, 2026
@github-actions github-actions Bot added this to the 0.4.18 milestone Sep 25, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 8af1b5b into dev Sep 25, 2026
3 checks passed
@ZhuchkaTriplesix
ZhuchkaTriplesix deleted the issue/888-duplicate-row-clear-pk branch September 28, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working data-grid Interactive data grid, cell editor, filtering, groupings frontend Theme parser epic label: frontend ux User experience, keyboard shortcuts and interactions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant