New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MySQL 8.0.19 Removes the int LENGTH #16138
Comments
|
Okay, good information. We'll have to consider a few instances where this could affect us: Creating tablesWhen using the GUI to create or modify a table, we should check the MySQL version and ignore the length for MySQL 8.0.19 and newer. A new feature could disable the length field except for when the appropriate data types are selected (enum, set, varchar, varbinary), but that's beyond the scope of this particular issue. There's currently no error shown so this doesn't seem to be a big deal at the moment. SQL linterDo we need to make sql-parser aware of this, so that it properly lints queries? AFAIK, we don't have any way to detect particular SQL flavors (MySQL vs MariaDB, etc) so this might be a large undertaking. ImportI don't think we do anything to the import engine. If people try to import malformed SQL, that's not something we usually detect and I think this falls in to a similar behavior. We should just pass along the SQL statements to MySQL and let MySQL handle or fail the statements. |
|
As I can see, for this to be done, we should only check the MySQL version and ignore the length for MySQL 8.0.19 and above if the type is |
I am not sure about the solution, maybe @ibennetch would have better advice to say |
|
My thought for this is that we should check the version, type and the attribute. Which maybe could be done with a separate utility which then will be used in the phpmyadmin/libraries/classes/Table.php Lines 545 to 550 in 2291814
If you don't prefer to use a separate utility for this, we can make it inline in the same file, but i think it will look messy. |
|
You're on to the right idea. We test for MySQL and MariaDB versions in several places throughout the code, for instance https://github.com/phpmyadmin/phpmyadmin/com#diff-b47bc389d7238e77949201866d47131c8d49e0cccb303558010a28aae233a196 or most notably in the many calls to The test should be:
That's a lot to check, so if we reuse the check anywhere it can be turned in to a utility function in libraries/Util.php, but I think it's fine to do the check in the page when we show the create/edit dialog. However, I'm not sure what we need to do right now. Including the length causes MySQL to ignore it, not throw an error, so we're doing okay there. The table structure tab displays correctly because we just show what MySQL tells us about the table. What we might want to do is show a warning message (similar to the warnings we show on the Insert page; I don't recall anything we warn about from the structure page), that warning could just say "The column width is ignored in your MySQL version unless defining a TINYINT(1) column or using the ZEROFILL attribute". I'm not sure if any changes should be made to the linter, that could be discussed further. |
Alright, are you thinking about only showing a warning message, and not ignore it ourselves as I stated in my previous comment? For the warning message, is it how it should appears? If this's the intended way, wouldn't it be better to mention that it's only about the integer types? And I think as per #16742, the I'm not sure for this case, if this is the correct way to show a warning message (using the twig file and hide/show using |
… warning Fixes: phpmyadmin#16138 Signed-off-by: Fawzi E. Abdulfattah <iifawzie@gmail.com>
Signed-off-by: William Desportes <williamdes@wdes.fr>

Using docker image
Ref: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-19.html
The demo server has 8.0.18
cc @MauricioFauth @ibennetch
Feel free to double check.
From what I tested it makes either useless changing the length or impossible using the GUI as the field is always empty
The text was updated successfully, but these errors were encountered: