IP contains
Returns true when the network on the left, in CIDR notation, contains the IPv4 address on the right, for example '10.0.0.0/8' >>= ip. The mirror of <<=.
Category: comparison
SQL symbol: >>=
Precedence: level 7 of 15 (1 binds tightest) — see operator precedence.
Syntax
sql
<network> >>= <address>Parameters
<network>— The network to test against, in CIDR notation, with its prefix length. Acceptsvarchar.<address>— An IPv4 address. It is held as its 32-bit integer value, which is why the signature below reads INTEGER. Acceptsinteger.
Returns
Examples
sql
SELECT '10.0.0.0/8' >>= CAST('10.0.0.1' AS IPV4);true
Signatures
varchar >>= integer→ boolean
Notes
Spelling follows PostgreSQL, CockroachDB and DuckDB's inet extension.