[Koha-bugs] [Bug 26328] incremental barcode generation fails when incorrectly converting strings to numbers

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Dec 7 02:02:15 CET 2020


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

--- Comment #7 from David Cook <dcook at prosentient.com.au> ---
(In reply to Pablo AB from comment #6)
> Why you like the most this one (except for the ABS identical to my first
> suggestion), instead of your alternative con comment 1? I remember that at
> the time your suggestion seems better.

Option 1: SELECT MAX(ABS(barcode)) FROM items WHERE barcode REGEXP '^[0-9]+$';

This query won't generate any warnings, so that's good. But it's also fairly
long and a little complex.

Option 2: SELECT max(cast(barcode as unsigned)) from items;

This query will show "Truncated incorrect..." warnings, but it's simpler/easier
to read/maintain. 

--

In the end, it doesn't really matter too much I think.

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


More information about the Koha-bugs mailing list