-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[4.0] Invalid SQL prevents saving of modules for Administrator #17752
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
Conversation
|
I cannot replicate the bug |
Can you give me additional information to your system and setup? |
|
@brianteeman Can you check the field configuration in the database? This is the modules table and it concerns the field content. In the current codebase, as referred to in the commit link, we have set ````content` text NOT NULL DEFAULT '',``` but MySQL doesn't support default values for text except for NULL.
I am not sure how the content fields is sometimes not given an error and sometimes is. However when the field is set as defined in the SQL file with not having a default value, the error should appear. |
|
|
|
Sorry ignore that comment |
|
Extensions database said it was up to date but clearly it wasnt - reinstalling and rechecking |
|
reinstalled - still dont have a bug |
|
@brianteeman This is weird right? In your screenshot I can see there is no default value nor is this module saving any data for a content field because it doesn't have this field. I wonder if this is something related to the new nulldate in 5.7, which doesn't stop Joomla from functioning but you can't update the fields using PhpMyAdmin for example. I was able to reproduce this by renaming the modules table and create it again using the SQL command from the SQL file. If I then tried to save the module I see the error. Of course I had to change the SQL query to not include the DEFAULT '' because otherwise it would not execute the query. Regardless, looking at the MySQL documentation, the SQL code must be fixed. |
|
I am running 5.7 so maybe |
|
@brianteeman Thanks for your testing! As your screenshot shows, there is no default. The install script creates a default of |
|
The different behaviour is most likely caused by different MySQL/MariaDB versions. |
|
@nibra I wouldn't be surprised. Do you agree that the SQLs should be fixed regardless because it is invalid SQL syntax? |
|
To be honest I lean so heavily on ORMs and DBALs to build my schemas that I don't know if this is "right" or "wrong". So I defer to those who do, but if this change does result in using valid SQL syntax then it looks fine to me. |
|
I am just going by the MySQL documentation in this case. Going to poke Eli. |
|
Yes, using NULL as default for 'no value' is the right thing to do. |
😆 |
|
we should seriously start thinking about "schema" re-design |
I don't think I got your message right... What is it supposed to look like? The thing is, I experienced an error with the SQL installation script as it is right now, so for people with my combination of software running, we need a fix for that. I forgot to post that information, I guess: In the MySQL documentation, I found this for MySQL 5.5-5.7:
|
|
''' @alikon I'll ping you directly. We are in the process of full schema revisit (including FKs) |
|
@aschkenasy Is this PR still relevant if a new schema is coming? |
|
In any case the current installation SQL file is wrong
This default value is ignored by MySql / Maria-DB during table creation, but this lack of default value results in some DB versions with this error message so in any case this and all the other default values for text / mediumtext / etc columns,
|
|
@ggppdk: Exactly my point! |
|
If we get a new schema that will take care of all these issues as well I would think. |
I was not aware of this, can you like to information about "new schema" ? |
|
It will, for sure, solve this problem. How far is the development of a new database scheme? I think until that's released, this quick bugfix is okay for now (when I remove |
|
@ggppdk I was not aware of a new schema either until Eli mentioned it in this comment . @eXsiLe95 Since this PR is for 4.0 it won't be a quick fix unless the new schema is not going to be implemented in 4.0. If it is broken in Joomla 3 as well, we should have a separate PR for Joomla 3. |
@aschkenasy I'll take care of it tomorrow! |
|
@eXsiLe95 awesome. thank you. |
|
Looks like this has been resolved elsewhere and can be closed. |
|
Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/17752 |


Summary of Changes
Edited 'content' field on table '#__modules' to be NULL by default.
Testing Instructions
Expected result
Module gets saved and can be added to a custom menu
Actual result
Additional information
After I got the said error (see above), I tried to figure out why there is no value in the SQL request for 'content' I figured out that the type TEXT doesn't allow anything else but NULL as a default value.
This refers to 792c3d5#diff-135c6f58583408312a709459b19594c7R1451