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.
This commit is contained in:
t8y2
2026-05-12 17:00:42 +08:00
parent 90e32ec683
commit 62a79ab611
+4 -1
View File
@@ -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;