`system` is a keyword in MySQL 8 and should not be used

Created on 15 February 2024, 9 months ago
Updated 29 February 2024, 9 months ago

Problem/Motivation

There is an exception raised just by enable this module.

PDOException: 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 'system WHERE ( (status = '1') OR( (status = '0') AND (schema_version > '-1') ))' at line 3: SELECT system.filename AS filename, system.name AS name, system.status AS status, system.info AS info FROM {system} system WHERE ( (status = :db_condition_placeholder_0) OR( (status = :db_condition_placeholder_1) AND (schema_version > :db_condition_placeholder_2) )); Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => 0 [:db_condition_placeholder_2] => -1 ) in missing_module_find_missing() (line 30 of /var/www/html/sites/all/modules/missing_module/missing_module.module).

Currently I am using AWS RDS MySQL community ver. 8

Steps to reproduce

Enable module

Proposed resolution

In `missing_module.module` file ln:15, you have this:

$query = db_select('system')->fields('system', array('filename', 'name', 'status', 'info'));

Since `system` is a keyword used by MySQL, I changed it to:

$query = db_select('system', 'sys')->fields('sys', array('filename', 'name', 'status', 'info'));

It works.

🐛 Bug report
Status

Needs review

Version

1.2

Component

Code

Created by

🇭🇰Hong Kong alucard001

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024