Declaration
IS_IPV4(expr)
Description
If the expr parameter is a valid IPv4 address string, 1 is returned; otherwise, 0 is returned.
For a specified parameter, if IS_IPV4() returns 1, then INET_ATON() and INET6_ATON() return non-NULL. Conversely, this is not always true. In some cases, when IS_IPV4() returns 0, INET_ATON() may return a non-NULL value. IS IPV4() has stricter requirements for IPv4 addresses than INET_ATON(), while INET6_ATON() is as stringent as IS_IPV4() when checking IPv4 addresses.
Examples
obclient> SELECT IS_IPV4('10.x.x.9'), IS_IPV4('10.x.x.256');
+---------------------+-----------------------+
| IS_IPV4('10.x.x.9') | IS_IPV4('10.x.x.256') |
+---------------------+-----------------------+
| 1 | 0 |
+---------------------+-----------------------+
1 row in set