[MDEV-14053] Unquoted NULL default values in information schema with views Created: 2017-10-12 Updated: 2018-10-08 Resolved: 2018-10-08 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Admin statements |
| Affects Version/s: | 10.2.7, 10.2.9 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Sébastien Vanvelthem | Assignee: | Unassigned |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 16.04x64 |
||
| Attachments: |
|
||||||||||||
| Issue Links: |
|
||||||||||||
| Description |
|
I'm currently working on doctrine support for mariadb 10.2 and information_schema changes introduced in 10.2.7 ( I faced an unexpected case in information schema concerning default values. I understand the new behavior of 'NULL' being quoted. And it works well, except that after an upgrade from 10.2.6 to 10.2.7, not all the fields have been converted to the new spec. As an example:
Should not return any row, but returns 4 rows on my database (amongst 4206 fields matching default is null). The column is nullable and the column_default is NULL (should be 'NULL'). See attached screenshot 086. For info, the normal behaviour was working:
For this one, 4202 records worked. See screenshot 087. It's only happening after upgrade to 10.2.7. So I guess the upgrade of information_schema failed somewhere. If I recreate the database the information_schema is correct. |
| Comments |
| Comment by Sébastien Vanvelthem [ 2017-10-12 ] | ||||||||||||||||||||||||||||||||||||||
|
@serg FYI, doctrine (and related owncloud, nextcloud, most symfony apps...) does not yet support mariadb 10.2 due to information schema changes. But it's on the way. This issue does not block us (I've made a test for this situation) | ||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2017-10-13 ] | ||||||||||||||||||||||||||||||||||||||
|
belgattitude, can you paste SHOW CREATE TABLE for the tables which contain those columns?
| ||||||||||||||||||||||||||||||||||||||
| Comment by Sébastien Vanvelthem [ 2017-10-13 ] | ||||||||||||||||||||||||||||||||||||||
|
Yep, nothing special:
| ||||||||||||||||||||||||||||||||||||||
| Comment by Sébastien Vanvelthem [ 2017-10-13 ] | ||||||||||||||||||||||||||||||||||||||
|
Dear Elena, Sorry my bad. It's a VIEW not a TABLE. Problem happens only with views. Let me know if I can help on this and thanks for your time. | ||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2017-10-13 ] | ||||||||||||||||||||||||||||||||||||||
|
belgattitude, sorry, I don't understand. What is a view and not table? | ||||||||||||||||||||||||||||||||||||||
| Comment by Sébastien Vanvelthem [ 2017-10-15 ] | ||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova, > The query result in first screenshot does not have table names, but there are two pairs of columns with the same names, I assume one pair belongs to the base table, and the other pair belongs to a view. I checked and both are views (one from staging db, the other from dev db). At first I recreated the schemas, my migration tool created invalid migrations (changing view in tables), that's how it explain why I felt the problem disappeared and suspect an incorrect schema upgrade on server part. So I tested from your example:
Both table and view have a default of 'NULL'. After removing the default:
Both table and view have a default of NULL. All good then. But in my previous example, the view I had was :
A schema inspection gives
The weird thing happens when I look at the corresponding table.column:
The originating column is actually non-nullable default. The view gives a nullable default. So the problem is very different from what I originally thought. But probably still a bug. FYI, I'm currently working on doctrine support for MariaDB 10.2.7, and tried to give some indications in the code (see: https://github.com/belgattitude/dbal/blob/ad52f401c8d543060eda564f85b772c10dba9cad/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php#L223). I'll update the comment, but thanks to you I know that we the 'NULL' is not enforced and therefore should be tested on our side too. | ||||||||||||||||||||||||||||||||||||||
| Comment by Sébastien Vanvelthem [ 2017-10-23 ] | ||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova, This ticket can be closed. Thanks for your explanation, I've narrowed the problem not being linked to information_schema upgrade. See my previous comment, the 'NULL' vs NULL happens only for views (in information schema: The view and the base table defaults values gives different "notations") Up to you to open a new issue for that specific case. | ||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2018-10-08 ] | ||||||||||||||||||||||||||||||||||||||
|
Sorry there was no reply before.
|