Browse Source

Merge pull request #1876 from nocodb/fix/1835-pg-list-with-json-column

fix: use union all instead of union since rows will be unique
pull/1966/head
աɨռɢӄաօռɢ 3 years ago committed by GitHub
parent
commit
f47bb34ecb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts

8
packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts

@ -236,7 +236,6 @@ class BaseModelSqlv2 {
const aliasColObjMap = await this.model.getAliasColObjMap();
const filterObj = extractFilterFromXwhere(where, aliasColObjMap);
// todo: replace with view id
if (!ignoreFilterSort && this.viewId) {
await conditionV2(
[
@ -320,7 +319,7 @@ class BaseModelSqlv2 {
const childQb = this.dbDriver.queryBuilder().from(
this.dbDriver
.union(
.unionAll(
ids.map(p => {
const query = qb
.clone()
@ -396,7 +395,6 @@ class BaseModelSqlv2 {
);
return children.map(({ count }) => count);
// return _.groupBy(children, cn);
} catch (e) {
console.log(e);
throw e;
@ -528,7 +526,7 @@ class BaseModelSqlv2 {
const qb = this.dbDriver(rtn).join(vtn, `${vtn}.${vrcn}`, `${rtn}.${rcn}`);
await childModel.selectObject({ qb });
const finalQb = this.dbDriver.union(
const finalQb = this.dbDriver.unionAll(
parentIds.map(id => {
const query = qb
.clone()
@ -636,7 +634,7 @@ class BaseModelSqlv2 {
.count(`${vtn}.${vcn}`, { as: 'count' });
// await childModel.selectObject({ qb });
const children = await this.dbDriver.union(
const children = await this.dbDriver.unionAll(
parentIds.map(id => {
const query = qb
.clone()

Loading…
Cancel
Save