1
0
Fork 0
mirror of synced 2024-10-05 04:25:21 +13:00

Fix sqlAlias.spec.ts

This commit is contained in:
Sam Rose 2024-10-01 16:17:11 +01:00
parent addd54a8e8
commit 7cee1509aa
No known key found for this signature in database

View file

@ -810,13 +810,18 @@ class InternalBuilder {
getTableName(t?: Table | string): string {
let table: Table
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
// querying against a table that may not have been imported into
// Budibase.
return t
} else {
table = this.query.meta.tables[t]
}
table = this.query.meta.tables[t]
} else if (t) {
table = t
} else {