Skip to content
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

MediaWiki needs SHOW ENGINES to return first letter uppercase column names like MySQL #7574

Closed
timsehn opened this issue Mar 6, 2024 · 3 comments
Labels
bug Something isn't working correctness We don't return the same result as MySQL sql Issue with SQL

Comments

@timsehn
Copy link
Contributor

timsehn commented Mar 6, 2024

MediaWiki runs the following SQL on installation.

CREATE TABLE `site_identifiers` (
si_type VARBINARY(32) NOT NULL,
si_key VARBINARY(32) NOT NULL,
si_site INT UNSIGNED NOT NULL,
INDEX si_site (si_site),
INDEX si_key (si_key),
PRIMARY KEY(si_type, si_key)
) ENGINE=, DEFAULT CHARSET=binary

On Dolt, we get the following error:

WARN[0308] error running query connectTime="2024-03-06 15:31:53.160714 -0800 PST m=+308.583663001" connectionDb=media_wiki connectionID=7 error="syntax error at position 327 near 'ENGINE'"
@timsehn timsehn added bug Something isn't working sql Issue with SQL correctness We don't return the same result as MySQL labels Mar 6, 2024
@timsehn
Copy link
Contributor Author

timsehn commented Mar 6, 2024

Looks like this is the result of Dolt not returning anything for the SHOW ENGINES command:

 15:38:06.559811 -0800 PST m=+9.553067251" connectionDb= connectionID=4 query="SHOW /* MysqlInstaller::getEngines */ ENGINES"

@timsehn
Copy link
Contributor Author

timsehn commented Mar 6, 2024

Looks like we return capitalized column names in SHOW ENGINES

tmp/main> show engines;
+--------+---------+------------------------------------------------------------+--------------+-----+------------+
| ENGINE | SUPPORT | COMMENT                                                    | TRANSACTIONS | XA  | SAVEPOINTS |
+--------+---------+------------------------------------------------------------+--------------+-----+------------+
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES          | YES | YES        |
+--------+---------+------------------------------------------------------------+--------------+-----+------------+

and MySQL return capitalized first letter:

mysql> SHOW /* MysqlInstaller::getEngines */ ENGINES;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| ndbinfo            | NO      | MySQL Cluster system information storage engine                | NULL         | NULL | NULL       |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| ndbcluster         | NO      | Clustered, fault-tolerant tables                               | NULL         | NULL | NULL       |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
11 rows in set (0.0004 sec)

MediaWiki relies on the casing of these column namess being the same as MySQL:

https://github.com/wikimedia/mediawiki/blob/4c97b4f417dd0887778bef58b2b3f349f0259089/includes/installer/MysqlInstaller.php#L261

@timsehn timsehn changed the title MediaWiki thinks Create table with ENGINE=; is valid MySQL syntax MediaWiki needs SHOW ENGINES to return first letter uppercase column names like MySQL Mar 6, 2024
@jycor
Copy link
Contributor

jycor commented Mar 7, 2024

some trimmed output from mysql (with --column-type-info)

mysql> select * from information_schema.engines;
Field 1
Name:      `ENGINE`
Org_name:  `ENGINE`
Catalog:   `def`
Database:  `information_schema`
Table:     `engines`
Org_table: `ENGINES`
Type:      String
DbType:    VAR_STRING
Collation: utf8mb4_0900_ai_ci (255)
Length:    192
Decimals:  0
Flags:     NOT_NULL

...

+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| ENGINE             | SUPPORT | COMMENT                                                        | TRANSACTIONS | XA   | SAVEPOINTS |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| ndbinfo            | NO      | MySQL Cluster system information storage engine                | NULL         | NULL | NULL       |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| ndbcluster         | NO      | Clustered, fault-tolerant tables                               | NULL         | NULL | NULL       |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
11 rows in set (0.0005 sec)
mysql> show engines;
Field 1
Name:      `Engine`
Org_name:  `ENGINE`
Catalog:   `def`
Database:  `information_schema`
Table:     `ENGINES`
Org_table: `ENGINES`
Type:      String
DbType:    VAR_STRING
Collation: utf8mb4_0900_ai_ci (255)
Length:    192
Decimals:  0
Flags:     NOT_NULL
...
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| ndbinfo            | NO      | MySQL Cluster system information storage engine                | NULL         | NULL | NULL       |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| ndbcluster         | NO      | Clustered, fault-tolerant tables                               | NULL         | NULL | NULL       |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
11 rows in set (0.0005 sec)

Currently, dolt/gms does not distinguish between org_name and name.
The linked PR should fix this issue for this particular table, but it appears there might be more we have to do to completely avoid case-sensitive issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctness We don't return the same result as MySQL sql Issue with SQL
Projects
None yet
Development

No branches or pull requests

3 participants