Syntax
IS_IPV4(expr)
Purpose
It returns 1 if the expr argument is a string indicating a valid IPv4 address, and returns 0 if otherwise.
For a specified argument, if the IS_IPV4() function returns 1, the INET_ATON() and INET6_ATON() functions return a non-NULL value. However, if the INET_ATON() and INET6_ATON() functions return a non-NULL value, the IS_IPV4() function does not necessarily return 1. Sometimes, when the IS_IPV4() function returns 0, the INET_ATON() function also returns a non-NULL value.
IS_IPV4() has stricter requirements on IPv4 addresses than INET_ATON(). INET6_ATON() is as powerful as IS_IPV4() in checking IPv4 addresses.
Examples
obclient> SELECT IS_IPV4('10.0.2.9'), IS_IPV4('10.0.2.256');
+---------------------+-----------------------+
| IS_IPV4('10.0.2.9') | IS_IPV4('10.0.2.256') |
+---------------------+-----------------------+
| 1 | 0 |
+---------------------+-----------------------+
1 row in set