Skip to content

SQL Auto-completion Does Not Work for Aliases from Derived Tables #1697

@gkjoyes

Description

@gkjoyes

What happened?

Description

When writing a query that joins a derived table (subquery) with an alias, auto-completion does not suggest columns for the derived table alias.

For example, in the query below, auto-completion works for hs.* but not for ahs.*.

Reproduction Query

SELECT YEAR,
       hs.country,
       happiness_score,
       ahs.avg_happiness_score
FROM happiness_scores hs
LEFT JOIN (
  SELECT country,
         AVG(happiness_score) AS avg_happiness_score
  FROM happiness_scores
  GROUP BY country
) ahs
  ON hs.country = ahs.country;

Expected Behavior

Auto-completion should recognize the derived table alias ahs and suggest:

  • country
  • avg_happiness_score

Database type

MySQL / MariaDB

TablePro version

0.51.1

macOS version & chip

macOS 26.5

Screenshots / Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions