From bffab3a4dc14e3b20333109f02e2e8f3a7f1487d Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Wed, 2 Sep 2020 16:29:02 +0200 Subject: [PATCH] ModelQuery: actually fix fields conflicts for jointures ref: 68ff977bcc4171f9cc4525feef6c8f704c97dacf --- src/db/ModelQuery.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/db/ModelQuery.ts b/src/db/ModelQuery.ts index ade72e3..76f863f 100644 --- a/src/db/ModelQuery.ts +++ b/src/db/ModelQuery.ts @@ -90,10 +90,10 @@ export default class ModelQuery { public toString(final: boolean = false): string { let query = ''; - if (this._pivot) { - this.fields = this.fields.map(f => this.table + '.' + f); - this.fields.push(...this._pivot); - } + // Prevent wildcard and fields from conflicting + if (this._leftJoin) this.fields = this.fields.map(f => this.table + '.' + f); + + if (this._pivot) this.fields.push(...this._pivot); let fields = this.fields.join(',');