MySQL is 5.7.23.
IFNULL(INET_ATON(\'\'),0)
returns a 0 in a plain select, but ERRORS during update ... set
assignment
Q: Is there a
Thanks for the insight Bill.
Turns out there are only a dozen places in the app where INET_ATON
is used, so I'm going to push admin to let me change those to APP_INET_ATON
which will only call system INET_ATON
when the IP_STRING is 'legitimate'.
DROP FUNCTION IF EXISTS APP_INET_ATON;
CREATE FUNCTION APP_INET_ATON(IP_STRING VARCHAR(50)) RETURNS bigint DETERMINISTIC
RETURN
CASE
WHEN IP_STRING IS NULL THEN 0
WHEN IP_STRING NOT REGEXP '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$' THEN 0
ELSE INET_ATON (IP_STRING)
END;
Figuring out where the 'bad' IP_STRING values are coming from is for another day.