[MDEV-15497] Wrong empty value in a GEOMETRY column on LOAD DATA Created: 2018-03-07 Updated: 2019-02-23 Resolved: 2018-03-07 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data types, GIS |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.2, 10.3 |
| Fix Version/s: | 10.3.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Alexander Barkov | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||
| Description |
|
I go to MariaDB data directory and create a file consisting of a single digit 1 in the database test:
Now I load this file into a table with two columns, with the second column being GEOMETRY NOT NULL:
Notice, the file ends unexpectedly and the GEOMETRY column correctly reports the error that it cannot be set to a valid value. Now I run the same script but add a FIELD TERMINATED BY '' clause:
Hmm, it inserted a record. Let's check values:
Notice, the GEOMETRY column was assigned to an empty string value. This is not a valid GEOMETRY value. It should report the same error with the first script. Now I test the same scripts, with for nullable columns:
Notice, it inserted the record. Let's check values:
It inserted NULL into the GEOMETRY column. Looks fine. Now do the same with FIELDS TERMINATED BY '':
It inserted a record, let's check values:
Oops. It erroneously inserted an empty string again. It should insert NULL, like in the previous script. |
| Comments |
| Comment by Alexander Barkov [ 2018-03-07 ] | ||||||||||||||||||||
|
A similar problem is repeatable with the CHAR data type (again, when the column b does not have data):
Notice, without FIELDS TERMINATED BY, column b gets assigned to NULL. With FIELDS TERMINATED BY it gets assigned to empty string. But this seems to be by design. | ||||||||||||||||||||
| Comment by Alexander Barkov [ 2019-02-23 ] | ||||||||||||||||||||
|
Backported to 10.2.23, as a part of |