diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index 4137ee0065..0d2d6c2aa6 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -3255,6 +3255,17 @@ class BaseModelSqlv2 { } rowId = pkObj; } + + // handle if primary key is not ai or ag + if (!ai && !ag) { + const pkObj = {}; + for (const pk of this.model.primaryKeys) { + const key = pk.title; + pkObj[key] = insertObj[pk.column_name] ?? null; + } + rowId = pkObj; + } + return rowId; }