From 58e42714402c4f90c10820f9ff5b80c23e5b7e64 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 28 Feb 2024 14:38:43 +0000 Subject: [PATCH] Fixing issue with quotes/graves. --- packages/server/src/api/controllers/row/alias.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/controllers/row/alias.ts b/packages/server/src/api/controllers/row/alias.ts index d2d41e085f..c27bed6a4b 100644 --- a/packages/server/src/api/controllers/row/alias.ts +++ b/packages/server/src/api/controllers/row/alias.ts @@ -57,13 +57,15 @@ export default class AliasTables { const tableNames = this.tableNames if (field.includes(".")) { const [tableName, column] = field.split(".") - const foundTableName = tableNames.find(name => tableName.includes(name)) + const foundTableName = tableNames.find( + name => tableName.includes(name) && tableName.indexOf(name) <= 1 + ) if (foundTableName) { const aliasedTableName = tableName.replace( foundTableName, this.getAlias(foundTableName) ) - return `${aliasedTableName}.${column}` + field = `${aliasedTableName}.${column}` } } return field