diff --git a/packages/web-console/src/utils/questdb.ts b/packages/web-console/src/utils/questdb.ts index f4f3b64b7..d00b930e2 100644 --- a/packages/web-console/src/utils/questdb.ts +++ b/packages/web-console/src/utils/questdb.ts @@ -348,22 +348,37 @@ export class Client { } async showTables(): Promise> { - const response = await this.query("tables();") + type BackwardsCompatibleTable = Table & { + /** @deprecated use `table_name` instead */ + name: string + } + + const response = await this.query("tables();") if (response.type === Type.DQL) { return { ...response, - data: response.data.slice().sort((a, b) => { - if (a.table_name > b.table_name) { - return 1 - } - - if (a.table_name < b.table_name) { - return -1 - } + data: response.data + .slice() + .sort((a, b) => { + const aName = a.table_name ?? a.name + const bName = b.table_name ?? b.name + if (aName > bName) { + return 1 + } + + if (aName < bName) { + return -1 + } + + return 0 + }) - return 0 - }), + // @TODO: remove this once upstream questdb releases version with `table_name` + .map((table) => ({ + ...table, + table_name: table.table_name ?? table.name, + })), } }