phpmyadmin / phpmyadmin/phpmyadmin
SQL query editor completion: Special characters in column names not supported
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 7.9k
- Forks
- 3.6k
- Avg merge
- 4d 18h
- Merged PRs (30d)
- 36
Description
Describe the bug
The Ctrl+Space code completion in the SQL query editor doesn't support special characters in column names very well.
To Reproduce
Steps to reproduce the behavior:
- Go to https://demo.phpmyadmin.net/master-config/index.php?route=/table/sql&db=burger_code&table=categories&server=1
- Add columns
ITM-main#and#main(names contain special characters):
ALTER TABLE `categories` ADD `ITM-main#` INT NOT NULL AFTER `name`;
ALTER TABLE `categories` ADD `#main` INT NOT NULL AFTER `name`;
- Try to use the columns in SQL query completion (Ctrl+Space). Examples after inital query text (
|is the prefix/completion position; press Ctrl+Space, choose ITM-main# or #main from the popup):
SELECT * FROM `categories` WHERE |
| prefix | result | expected |
|---|---|---|
| (none) | ITM-main# |
`ITM-main#` |
IT |
ITM-main# |
`ITM-main#` |
ITM- |
ITM-ITM-main# |
`ITM-main#` (or ITM-`ITM-main#` if you consider the - a difference operator) |
` |
`ITM-main#` |
`ITM-main#` (good) |
`ITM |
`ITM-main#` |
`ITM-main#` (good) |
`ITM- |
`ITM-ITM-main# |
`ITM-main#` |
`ITM-ma |
no useful proposals | `ITM-main#` |
# |
##main |
`#main` |
#ma |
#ma#main |
`#main` |
` |
`#main` |
`#main` (good) |
`# |
`##main |
`#main` |
`#ma |
`#ma#main |
`#main` |
Expected behavior
Completion of special column names should work like for columns with regular names. After choosing something from the popup, the column name should be completed and enclosed in ` ` if necessary.
Server configuration
- phpMyAdmin version: 5.0.2, 5.1.0-dev, and older versions
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Ctrl+Space completion cases in the SQL query editor using the example column names and prefixes from the issue. Trace the completion entry point and verify that selecting a special-character column produces the complete name with backticks where needed; done means the listed expected results work for both columns.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- database, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100