After updating Drupal 7 core from 7.74 to 7.77 my website no longer works.
It seems to be an error with MySQL executed on line 174 of view_custom_table.module.
clearing the cash using drush results in the following message:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM `mytablename` mytablename LIMIT 50 OFFSET 0' at line 1
WD menu: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name ' mytablename ': DESCRIBE { mytablename }; Array [error]
(
)
in view_custom_table_views_data() (line 174 of /var/www/webroot/ROOT/sites/all/modules/view_custom_table/view_custom_table.module).
Invalid argument supplied for foreach() views.module:155
When I disable the module the site works.
When I empty table custom_table_view_data the site also works with the module enabled.
When I add a new custom tabel the site gives an error after displaying this message on screen: Add columns relationship for [tablename]
It looks like information in column 'column_relations' is not correct. It is filled with: a:0:{}
How can this be fixed?
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | 3186756.patch | 1.67 KB | joseph.olstad |
| #15 | view_custom_table-blank-spaces-3186756-15.patch | 2.09 KB | mkrizaj |
Issue fork view_custom_table-3186756
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
eric wassink - qumup commentedComment #3
sirish.ayyagari commentedi am having same issue with views_custom_table, not sure why
$query = format_string('DESCRIBE { @table_name }', array('@table_name' => $custom_table->table_name));is failing in views_custom_table.moduleComment #4
sirish.ayyagari commentedFix::::
$conf['mysql_identifier_quote_character'] = '';adding this line to settings.php solved the problem
Comment #5
sirish.ayyagari commentedFixed!!!
$conf['mysql_identifier_quote_character'] = '';
adding this line to settings.php solved the problem
Comment #6
ckngSolution #4 is working.
Comment #7
avpadernoComment #8
alexh commentedThank you, I can also confirm that solution #4 is working.
Comment #9
eric wassink - qumup commentedThanks for this simple solution (#4).
Comment #12
oldspot commentedThat solution seemed more like a workaround rather than fixing the actual problem, especially when it involves updating such an important constant.
I've debugged the issue a bit and seems like the error is happening due to the blank spaces before and after the "@table_name" - it looks like it's literally looking for the table name including the spaces which is why it can't find it.
Looking at all other examples of code in core and the db_query documentation the spaces before or after the table name are not needed so I've created a PR for it and works fine for me.
Comment #13
avpadernoComment #14
oknaru commented#12 works for me perfect.
Remove space before & after the table_name line 173
'DESCRIBE {@table_name}'Comment #15
mkrizaj commentedI've created a patch for the issue raised above.
Comment #16
khurrami commented#12 works for me perfect.
Thanks
Comment #17
avpadernoThe patch needs to be created from the directory containing the module.
Comment #18
oldspot commentedI've update my Merge Request to include the extra occurrence of blank space found by @mkrizaj
As per the new gitlab merge requests documentation - https://www.drupal.org/drupalorg/docs/gitlab-integration/issue-forks-mer... - you can get the patch by appending ".patch" to the merge request url rather than creating new patch files:
https://git.drupalcode.org/project/view_custom_table/-/merge_requests/1....
Comment #19
oldspot commentedUpdating to 'Needs review' as added the extra fix but the rest of it has been confirmed as working by a few above so could go to RTBC soon.
Comment #20
alexh commentedThanks oldspot and mkrizaj. This is certainly the better solution and it works.
Comment #21
tenamurphy commentedview_custom_table-blank-spaces-3186756-15.patch works perfectly for me. Thanks!!!!
Comment #22
oldspot commentedI've just stumbled into the same issue again when adding another custom table to views and can confirm the last fix added to the patch from @mkrizaj works well:
https://git.drupalcode.org/project/view_custom_table/-/merge_requests/1....
Changing to RTBC so it can be committed soon hopefully as I've just discovered a duplicate issue to this one which has the exact same solution:
https://www.drupal.org/project/view_custom_table/issues/3069124
Comment #23
promo-il commentedError on update Drupal 7.72 to 7.81. Patch #15 is OK
Comment #24
joseph.olstadComment #25
avpadernoThe correct code would be the following one.
See the code in
DrupalDatabaseCache::getMultiple().Comment #26
joseph.olstadNew release for Drupal 7 , version 7.x-1.0
download version 7.x-1.0
Comment #27
joseph.olstadComment #28
joseph.olstadpatch is against 7.x-1.6
Comment #30
joseph.olstadnew release shortly
Comment #31
joseph.olstadhere's the new release, enjoy and thanks everyone! Too bad we had to wait this long to get a maintainer.
https://www.drupal.org/project/view_custom_table/releases/7.x-1.1