Browse Source

fix: pass correct col-alias map to extract column id properly (#9903)

pull/10030/head
Pranav C 1 month ago committed by GitHub
parent
commit
403fb8b337
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 20
      packages/nocodb/src/db/BaseModelSqlv2.ts

20
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -3363,13 +3363,21 @@ class BaseModelSqlv2 {
await this.shuffle({ qb });
}
// pre-load columns for later user
await parentTable.getColumns(this.context);
await childTable.getColumns(this.context);
await (isBt ? parentModel : childModel).selectObject({
qb,
fieldsSet: listArgs.fieldsSet,
viewId: childView?.id,
});
const aliasColObjMap = await parentTable.getAliasColObjMap(this.context);
// extract col-alias map based on the correct relation table
const aliasColObjMap = await (relColumn.meta?.bt
? parentTable
: childTable
).getAliasColObjMap(this.context);
const filterObj = extractFilterFromXwhere(where, aliasColObjMap);
await this.getCustomConditionsAndApply({
@ -3506,7 +3514,10 @@ class BaseModelSqlv2 {
const rtn = parentTn;
const tn = childTn;
// pre-load columns for later user
await childTable.getColumns(this.context);
await parentTable.getColumns(this.context);
// one-to-one relation is combination of both hm and bt to identify table which have
// foreign key column(similar to bt) we are adding a boolean flag `bt` under meta
@ -3524,7 +3535,12 @@ class BaseModelSqlv2 {
})
.count(`*`, { as: 'count' });
const aliasColObjMap = await parentTable.getAliasColObjMap(this.context);
// extract col-alias map based on the correct relation table
const aliasColObjMap = await (relColumn.meta?.bt
? parentTable
: childTable
).getAliasColObjMap(this.context);
const filterObj = extractFilterFromXwhere(where, aliasColObjMap);
await this.getCustomConditionsAndApply({

Loading…
Cancel
Save