[MDEV-16352] Default values for text based fields contains a paired quotation marks Created: 2018-05-31 Updated: 2020-07-13 Resolved: 2020-07-13 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Create Table |
| Affects Version/s: | 10.3.7, 10.2 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Josep Sanz | Assignee: | Sergei Golubchik |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | describe, quotation_marks | ||
| Attachments: |
|
| Description |
|
When I create a table, I get different presentations when I execute the DESCRIBE statement for the default values of the text based fields. For example, If I create a varchar field, I get the default value without quotation marks when I execute the DESCRIBE statement, but when I create a text field (text, tinytext, mediumtext or longtext), I get the default value with quotation marks when I execute the DESCRIBE statement. I have attached a test case file. The actual result is:
The expected result is:
|
| Comments |
| Comment by Sergei Golubchik [ 2020-07-13 ] | ||||||||||
|
This is done for compatibility reasons. Before 10.2 TEXT columns could not have defaults at all and all defaults had to be literals. Since 10.2, one can use expressions as default values, and BLOB/TEXT can have defaults too. This feature made DESCRIBE output ambiguous. Consider
The output is
You can use INFORMATION_SCHEMA.COLUMNS to see the correct unambiguous values of DEFAULT, string literals will have quotes for CHAR and VARCHAR too. But for compatibility with old applications we did not change the output of DESCRIBE, so it works as before, not quoting default values that were not quoted before 10.2. |