[MDEV-23743] setting SQL_MODE to ANSI hides important table details from SHOW CREATE TABLE Created: 2020-09-16 Updated: 2020-09-18 |
|
| Status: | Confirmed |
| Project: | MariaDB Server |
| Component/s: | Server |
| Affects Version/s: | 10.4.14 |
| Fix Version/s: | 10.4, 10.5 |
| Type: | Bug | Priority: | Major |
| Reporter: | Rick Pizzi | Assignee: | Rucha Deodhar |
| Resolution: | Unresolved | Votes: | 4 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
When the SQL_MODE contains the ANSI keyword, show create table no longer displays important table details, like engine and charset. This causes confusion, and tools that rely on show create table like mydumper fail to work properly. For example, when dumping a table using the well known and widely used tool mydumper, it saves the table definition in the dump using show create table, and when that dump is later reloaded the table is created with server default engine and charset, which is incorrect (especially when you are trying to build a replica of another server).
|
| Comments |
| Comment by Rick Pizzi [ 2020-09-17 ] |
|
I do not agree that this is a duplicate of |
| Comment by Sergei Golubchik [ 2020-09-17 ] |
|
This was the case since at least MySQL as of 2006. In any "non-mysql" (or, say, "foreign" or "emulation") sql mode SHOW CREATE TABLE will omit MariaDB/MySQL specific table attributes. These "foreign" sql modes are ANSI, DB2, POSTGRESQL, MSSQL, MAXDB, and ORACLE. |
| Comment by Sergei Golubchik [ 2020-09-17 ] |
|
Logically, in your particular case, ENGINE=InnoDB is not part of the ANSI standard and thus it is correctly omitted from the table definition. |
| Comment by Rick Pizzi [ 2020-09-17 ] |
|
Sorry serg but the fact this was this way in 2006 doesn't necessarily mean it's correct today. Also, I am not worried about the Engine, but more about the charset, which actually caused my team to spend 2 days trying to understand what was going on with the just built replica. |
| Comment by Rick Pizzi [ 2020-09-17 ] |
|
Just wonder, if ANSI supports comments, a better approach would be to show the missing informations that way, |
| Comment by Sergei Golubchik [ 2020-09-18 ] |
I only wanted to clarify the "no longer displays" part of the original bug report. It created an impression that this is a recent change and I pointed out that it's not. Yes, the standard support both /* bracketed */ and -- end of line comments. We can put MariaDB-specific clauses in the comment, all right. |