Repository navigation
Open
Labels
BugA problem or regression with an existing featureEnhancementA feature request for improving phpMyAdminaffects/5.2This issue or pull-request affects 5.2.x releases (and maybe further versions)affects/6.0This issue or pull-request affects 6.0.x releases (and maybe further versions)confirmed/5.2This issue is confirmed to be reproduced on 5.2 at the time this label was setconfirmed/6.0This issue is confirmed to be reproduced on 6.0 at the time this label was set
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
Metadata
Metadata
Assignees
Labels
BugA problem or regression with an existing featureEnhancementA feature request for improving phpMyAdminaffects/5.2This issue or pull-request affects 5.2.x releases (and maybe further versions)affects/6.0This issue or pull-request affects 6.0.x releases (and maybe further versions)confirmed/5.2This issue is confirmed to be reproduced on 5.2 at the time this label was setconfirmed/6.0This issue is confirmed to be reproduced on 6.0 at the time this label was set
Activity
[-]SQL query editor: Special characters in column names not supported[/-][+]SQL query editor completion: Special characters in column names not supported[/+]markus-ksg commentedon Sep 8, 2020
To reproduce if the example database
burger_codedoesn't exist, just create the database and then create tablecategorieswith columnname.williamdes commentedon Sep 8, 2020
Thank you for reporting this issue, I hope someone will have a look into it :)
shucon commentedon Oct 19, 2020
Starting to work on this.
williamdes commentedon Feb 9, 2021
Hi @markus-ksg
Would you agree to test the latest version in development (phpMyAdmin 5.1+snapshot) ?
I think this is fixed now
markus-ksg commentedon Feb 10, 2021
I'd love to test it, but I couldn't find a Docker image that includes the latest 5.1 code.
I'm currently using the
phpmyadmin/phpmyadmin:latestimage, which contains 5.0.4. I tried to replace /var/www/html in the running docker container with the contents of https://files.phpmyadmin.net/snapshots/phpMyAdmin-5.1+snapshot-english.tar.gz . Afterchown -R --reference=html.bak html ; chmod --reference=html.bak html, I did get the login page, but after entering the credentials, I got redirected to /index.php?route=/ with error message "mysqli::real_connect(): (HY000/2002): No such file or directory".Do you have any hints on how I could test this locally?
https://demo.phpmyadmin.net/QA_5_1 shows some general error messages. After ignoring them, the bug still reproduces.
https://demo.phpmyadmin.net/master/ (5.2) also still exhibits the described bad behavior.
I'm afraid codemirror/codemirror5#6331 was not enough to fix this.
ibennetch commentedon Feb 10, 2021
That's correct, we don't publish Docker images for prerelease or release candidate versions.
You taught me a new argument to use with chown, nice!
Probably you need to change one line, in
libraries/vendor_config.phpfind the linedefine('CONFIG_DIR', ROOT_PATH);and change it todefine('CONFIG_DIR', '/etc/phpmyadmin/');(this is how the Docker image knows where to find the configuration files).This should be cleared up now.
That's unfortunate, thank you for the testing and response!
markus-ksg commentedon Feb 10, 2021
Thanks, that was it! Great that I can now test pre-release versions in my Docker setup. 5.1 looks good so far, but as expected, this bug also shows up locally.
I guess it's a CodeMirror issue in the completion implementation, since there are cases where useful column proposals are computed, but insertion fails to find the correct starting position.
ben-wckdrzr commentedon Jun 21, 2023
I found this page while looking for a solution to the same issue directly in CodeMirror - this is an issue in that package as mentioned, but doesn't seem to have been raised there.
I asked a question about this on the CodeMirror discussion (https://discuss.codemirror.net/t/quoting-table-names-when-using-schemacompletionsource/6721), and a fix was implemented in @codemirror/lang-sql v6.5.1
Not all of the test cases above pass, but most do; and enough for my needs
Just posting here to try and keep the internet tidy :D
williamdes commentedon Jul 13, 2023
Thanks
I think this is related to #18521