Fix sqlAlias.spec.ts
This commit is contained in:
parent
addd54a8e8
commit
7cee1509aa
|
@ -810,13 +810,18 @@ class InternalBuilder {
|
||||||
getTableName(t?: Table | string): string {
|
getTableName(t?: Table | string): string {
|
||||||
let table: Table
|
let table: Table
|
||||||
if (typeof t === "string") {
|
if (typeof t === "string") {
|
||||||
if (!this.query.meta.tables?.[t]) {
|
if (this.query.table?.name === t) {
|
||||||
|
table = this.query.table
|
||||||
|
} else if (this.query.meta.table?.name === t) {
|
||||||
|
table = this.query.meta.table
|
||||||
|
} else if (!this.query.meta.tables?.[t]) {
|
||||||
// This can legitimately happen in custom queries, where the user is
|
// This can legitimately happen in custom queries, where the user is
|
||||||
// querying against a table that may not have been imported into
|
// querying against a table that may not have been imported into
|
||||||
// Budibase.
|
// Budibase.
|
||||||
return t
|
return t
|
||||||
}
|
} else {
|
||||||
table = this.query.meta.tables[t]
|
table = this.query.meta.tables[t]
|
||||||
|
}
|
||||||
} else if (t) {
|
} else if (t) {
|
||||||
table = t
|
table = t
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue