diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/BaseModel.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/BaseModel.ts index 1086bdd807..07ee28d5c9 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/BaseModel.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/BaseModel.ts @@ -302,10 +302,13 @@ abstract class BaseModel { for (const d of data) { await this.validate(d); } - - const response = await this.dbDriver - .batchInsert(this.tn, data, 50) - .returning(this.pks?.[0]?.cn || '*'); + + const response = (this.dbDriver.client === 'pg' || this.dbDriver.client === 'mssql') ? + this.dbDriver + .batchInsert(this.tn, data, 50) + .returning(this.pks?.[0]?.cn || '*') : + this.dbDriver + .batchInsert(this.tn, data, 50); await this.afterInsertb(data); diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSql.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSql.ts index c67c1bfb27..61a6f9fcd1 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSql.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSql.ts @@ -608,9 +608,12 @@ class BaseModelSql extends BaseModel { await this.validate(d1); } - const response = await this.dbDriver - .batchInsert(this.tn, insertDatas, 50) - .returning(this.pks[0].cn); + const response = (this.dbDriver.client === 'pg' || this.dbDriver.client === 'mssql') ? + await this.dbDriver + .batchInsert(this.tn, insertDatas, 50) + .returning(this.pks[0].cn) : + await this.dbDriver + .batchInsert(this.tn, insertDatas, 50); await this.afterInsertb(insertDatas, null); diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts index cea8bd15fc..07e9d93363 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts @@ -1826,9 +1826,12 @@ class BaseModelSqlv2 { // refer : https://www.sqlite.org/limits.html const chunkSize = this.isSqlite ? 10 : _chunkSize; - const response = await this.dbDriver - .batchInsert(this.model.table_name, insertDatas, chunkSize) - .returning(this.model.primaryKey?.column_name); + const response = (this.isPg || this.isMssql) ? + await this.dbDriver + .batchInsert(this.model.table_name, insertDatas, chunkSize) + .returning(this.model.primaryKey?.column_name) : + await this.dbDriver + .batchInsert(this.model.table_name, insertDatas, chunkSize); await this.afterBulkInsert(insertDatas, this.dbDriver, cookie);