Skip to content

Wrong Autosuggestion when Column Name ends with a Dot (.) #18521

Open

Description

@nicolasbachmaier

Describe the bug

The Autosuggestion for the column name is wrong in phpmyadmin when the column name ends with a dot (.)
For example if the Column Name is called `Article Nr.` the phpmyadmin autosuggestion will turn it into `Article Nr`.`` which is faulty / wrong.

To Reproduce

Steps to reproduce the behavior:

  1. Create a new Table and create one or multiple columns with a Dot (.) at the end, in this example Article Nr.
  2. Write for example a simple select Query and while typing `Article Nr.` (note: the apostrophes ` are important) a popup with the suggested Column name will appear
  3. Click on the Suggestion
  4. Instead of the expected `Article Nr.` it will fill in `Article Nr`.`` which will result in an error.

Expected behavior

The Autosuggestion should handle the dot at the end properly and when clicking on the suggestion it should fill in `Article Nr.`

Screenshots

Test-Case:
grafik

❌ Wrong (this happens right now):
grafik

✔ Expected (this should happen):
grafik

Server configuration

  • Operating system: Windows 10 (XAMPP Version 8.1.6)
  • Web server: Apache 2.4.53
  • Database version: MariaDB 10.4.24
  • PHP version: PHP 8.1.6 (VS16 X86 64bit thread safe) + PEAR
  • phpMyAdmin version: 5.2.0

(I was as well able to reproduce this on a Linux Webserver with slightly different specs)

Edit: This was as well reproduced on the newest Version of phpmyadmin by now.

Client configuration

  • Browser: Firefox 114.0.2 (64-Bit)
  • Operating system: Windows 10

Additional Information:

As suggested further below by me, this as well affects other components like for example the "Sorting": #18521 (comment)

Activity

  1. nicolasbachmaier commented on Jul 4, 2023

    @nicolasbachmaier
    Author

    This was initially tested on version 5.2.0, but I could as well reproduce this on the newest version (https://demo.phpmyadmin.net/)

  2. nicolasbachmaier commented on Jul 11, 2023

    @nicolasbachmaier
    Author

    Another related Bug: Sorting not possible when Column ends with / contains a Dot.

    Description:

    In phpmyadmin you usually can sort a table by clicking on a column heading. This however, doesn't work when the Table heading contains / ends with a dot ".".

    Expected Result:

    • Click on for example the heading `Article Nr.`
    • The Table should now be sorted by the Article Number ascending / descending ( "ORDER BY `Article Nr.` ASC" / "ORDER BY `Article Nr.` DESC" is added to the Query)

    Actual Result:

    • Click on for example the heading `Article Nr.`
    • Nothing happens. The table doesn't get sorted and nothing gets appended to the Query.
  3. williamdes commented on Jul 13, 2023

    @williamdes
    Member

    Thank you for this report!

  4. added
    Bug
    affects/5.2
    affects/6.0
    confirmed/5.2
    confirmed/6.0
    on Jul 13, 2023
  5. harshitrajsinha commented on Jul 30, 2023

    @harshitrajsinha

    Suppose there are two tables product1 and product2 with columns as idp1 and idp2. (where idp2 has DOT(.) at its end) respectively. If we try to join these two tables based on their IDs -
    A statement like: 'select * from product1, product2 where product1.idp1 = product2.idp2.;' will work. However, SQL allows to write statement without BACKTICK also and in such case 'select * from product1, product2 where product1.idp1 = product2.idp2.;' will break. Therefore, should we consider ending a column name or table name with DOT (.)?

  6. nicolasbachmaier commented on Jul 31, 2023

    @nicolasbachmaier
    Author

    Suppose there are two tables product1 and product2 with columns as idp1 and idp2. (where idp2 has DOT(.) at its end) respectively. If we try to join these two tables based on their IDs - A statement like: 'select * from product1, product2 where product1.idp1 = product2.idp2.;' will work. However, SQL allows to write statement without BACKTICK also and in such case 'select * from product1, product2 where product1.idp1 = product2.idp2.;' will break. Therefore, should we consider ending a column name or table name with DOT (.)?

    For me this is most definitely a yes.

    Permitted characters in quoted identifiers include the full Unicode Basic Multilingual Plane (BMP), except U+0000

    https://dev.mysql.com/doc/refman/8.0/en/identifiers.html

    Backticks in general don't have to be used when these conditions apply [0-9,a-z,A-Z$_] (you can read more about it in the documentation up there)
    For everything else, backticks must always be used, so yes, of course. Every column name (including one with an ending dot) that can't be used without backticks (like for example the SPACE character) must be used with backticks and should as well work accordingly in the autosuggestion and sorting etc..

    If you disagree, then please let me know why but in my understanding this is a logical flaw and should be fixed.

    (And yes, of course in theory it is best to name your columns like prefix_variable_name, but in this case easy variable names were required and i stumbled upon this bug. And according to mysql documentation this should be allowed and is allowed, so phpmyadmin should in theory be able to handle it as well)

  7. harshitrajsinha commented on Jul 31, 2023

    @harshitrajsinha

    That's also correct. I will try once again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugaffects/5.2affects/6.0confirmed/5.2confirmed/6.0good first issuehelp wanted

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions