From 62a79ab611540a65fd22931170863c10399ae0ed Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Tue, 12 May 2026 17:00:42 +0800 Subject: [PATCH] fix(grid): exclude columns with defaults from NOT NULL validation The save validator rejected NULL in NOT NULL columns even when the column has a DEFAULT (e.g. serial/sequence). Skip those columns so cloned rows with auto-increment PKs pass frontend validation. --- src/lib/dataGridSql.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/dataGridSql.ts b/src/lib/dataGridSql.ts index 8e1a0841d7..f51632286b 100644 --- a/src/lib/dataGridSql.ts +++ b/src/lib/dataGridSql.ts @@ -13,6 +13,7 @@ export interface DataGridTableMeta { export interface DataGridColumnInfo { name: string; is_nullable: boolean; + column_default?: string | null; } export interface DataGridSaveStatementOptions { @@ -36,7 +37,9 @@ export interface DataGridSaveValidationOptions { export function validateDataGridSave(options: DataGridSaveValidationOptions): string | undefined { const notNullColumns = new Set( (options.columnInfo ?? []) - .filter((column) => !column.is_nullable && !isOracleRowId(options.databaseType, column.name)) + .filter( + (column) => !column.is_nullable && !column.column_default && !isOracleRowId(options.databaseType, column.name), + ) .map((column) => normalizeColumnName(column.name)), ); if (notNullColumns.size === 0) return undefined;