[Koha-bugs] [Bug 17260] updatedatabase.pl fails on invalid entries in ENUM and BOOLEAN columns

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Oct 3 12:28:49 CEST 2016


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17260

--- Comment #3 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
(In reply to M. Tompsett from comment #2)
> Comment on attachment 55263 [details] [review]
> Bug 17260 - updatedatabase.pl fails on invalid entries in ENUM and BOOLEAN
> columns
> 
> Review of attachment 55263 [details] [review]:
> -----------------------------------------------------------------
> 
> ::: installer/data/mysql/updatedatabase.pl
> @@ +12280,4 @@
> >               `id` int(11) NOT NULL AUTO_INCREMENT, 
> >               `name` varchar(255) NOT NULL COMMENT 'the name of the field as it will be stored in the search engine',
> >               `label` varchar(255) NOT NULL COMMENT 'the human readable name of the field, for display', 
> > +             `type` ENUM('', 'string', 'date', 'number', 'boolean', 'sum') NOT NULL COMMENT 'what type of data this holds, relevant when storing it in the search engine',
> 
> I'm not sure how to test for this.

I do not have MySQL5.7 but:

mysql> insert into search_field(name, label, type)values('name', 'label', '');
Query OK, 1 row affected, 1 warning (0.01 sec)

mysql> show warnings;
+---------+------+-------------------------------------------+
| Level   | Code | Message                                   |
+---------+------+-------------------------------------------+
| Warning | 1265 | Data truncated for column 'type' at row 1 |
+---------+------+-------------------------------------------+
1 row in set (0.00 sec)

And given https://dev.mysql.com/doc/refman/5.7/en/constraint-enum.html:
"For a column defined as ENUM('a','b','c'), values such as '', 'd', or 'ax' are
invalid and are rejected."
I guess MySQL5.7 will raise an error instead of a warning.

ENUM should be avoided, but that would be for another bug report.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list