Browse Source

fix(gui): avoid using returning if primary key missing

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4120/head
Pranav C 2 years ago
parent
commit
77bd3c6128
  1. 2
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

2
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

@ -1423,7 +1423,7 @@ class BaseModelSqlv2 {
// const driver = trx ? trx : this.dbDriver; // const driver = trx ? trx : this.dbDriver;
const query = this.dbDriver(this.tnPath).insert(insertObj); const query = this.dbDriver(this.tnPath).insert(insertObj);
if (this.isPg || this.isMssql) { if ((this.isPg || this.isMssql) && this.model.primaryKey) {
query.returning( query.returning(
`${this.model.primaryKey.column_name} as ${this.model.primaryKey.title}` `${this.model.primaryKey.column_name} as ${this.model.primaryKey.title}`
); );

Loading…
Cancel
Save