phpmyadmin / phpmyadmin/sql-parser

Derived tables should require aliases

Open
#178 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
PHP
Stars
485
Forks
119
PR merge metrics
No merged PRs in 30d

Description

./bin/lint-query --query "SELECT * FROM table1 JOIN (select * from table2) ON some_column = some_other_column"

This passes the linter, but should fail because the subquery does not have an alias. Running this query in MySQL will return the error Every derived table must have its own alias.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the bin/lint-query entry point and trace how the shown derived-table query is parsed and linted. Reproduce the command, then identify where the missing alias is accepted; done means the query is rejected consistently with MySQL's requirement that every derived table has an alias.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
databases, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.