[MDEV-12686] Valid values (zero and false) appear as NULL (CONNECT JSON) Created: 2017-05-04 Updated: 2017-05-11 Resolved: 2017-05-08 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Connect |
| Affects Version/s: | 10.1.22 |
| Fix Version/s: | 10.1.24, 10.0.31 |
| Type: | Bug | Priority: | Major |
| Reporter: | Alice Sherepa | Assignee: | Olivier Bertrand |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 16.04 |
||
| Description |
|
When json file contains 0 or "false" values, CONNECT JSON type shows them as NULL, unless a column declared explicitly as not null.
|
| Comments |
| Comment by Olivier Bertrand [ 2017-05-04 ] | ||||||||||||||||||||||||||||||
|
NULL handling by connect is explained in the Data Types page of the documentation: Your example works as designed. Let us suppose the file is:
If the table is created leaving discovery find the column types, this is what is obtained:
and when using select:
The only problem is that CONNECT (nor MariaDB) does not have yet a true BOOL data type. This is why, TINYINT(1) is used instead. But is it clearly explained that the NULL handling is heavily depending on the null definition of the column. | ||||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2017-05-05 ] | ||||||||||||||||||||||||||||||
|
According to Codd's Rule 3 the engine should be able to handle differently null and zero at the same time and all other engines are capable to achieve this. | ||||||||||||||||||||||||||||||
| Comment by Olivier Bertrand [ 2017-05-05 ] | ||||||||||||||||||||||||||||||
|
Wait for the fix I've just done but not pushed yet.
Now for the file:
the result will be:
Thanks for reporting all this. | ||||||||||||||||||||||||||||||
| Comment by Olivier Bertrand [ 2017-05-08 ] | ||||||||||||||||||||||||||||||
|
It was a bug indeed. |