Skip to main content

Inet functions and operators

These apply to MonetDB SQL type: inet (IPv4 Network Address).

An IPv4 Network Address string has a specific syntax, see also IPv4 address.

Inet operators

Operator Description Example Result
< is less than inet '192.168.1.5' < inet '192.168.1.6' true
<= is less than or equal inet '192.168.1.5' <= inet '192.168.1.5' true
= equals inet '192.168.1.5' = inet '192.168.1.5' true
> is greater than inet '192.168.1.5' > inet '192.168.1.4' true
>= is greater than or equal inet '192.168.1.5' >= inet '192.168.1.5' true
<> is not equal inet '192.168.1.5' <> inet '192.168.1.4' true
<< is contained by inet '192.168.1.5' << inet '192.168.1/24' true
<<= is contained by or equals inet '192.168.1/24' <<= inet '192.168.1/24' true
>> contains inet '192.168.1/24' >> inet '192.168.1.5' true
>>= contains or equals inet '192.168.1/24' >>= inet '192.168.1/24' true


 


 


 


 


 

 

Inet functions

Note: You must include the sys. prefix for all these inet functions (see examples) in order to work properly from other schemas than sys.

Function Return type Description Example Result
sys.abbrev(inet) clob abbreviated display format as text sys.abbrev(inet '10.1.0.0/16') 10.1/16
sys.broadcast(inet) inet broadcast address for network sys.broadcast(inet '192.168.1.5/24') 192.168.1.255/24
sys.host(inet) clob extract IP address as text sys.host(inet '192.168.1.5/24') 192.168.1.5
sys.hostmask(inet) inet construct host mask for network sys.hostmask(inet '192.168.23.20/30') 0.0.0.3
sys.left_shift(inet, inet) boolean is contained by sys.left_shift(inet '192.168.1/24', inet '192.168.1.5') true
sys.left_shift_assign(inet, inet) boolean is contained by or equals sys.left_shift_assign(inet '192.168.1/24', inet '192.168.1/24') true
sys.masklen(inet) int extract netmask length sys.masklen(inet '192.168.1.5/24') 24
sys.netmask(inet) inet construct netmask for network sys.netmask(inet '192.168.1.5/24') 255.255.255.0
sys.network(inet) inet extract network part of address sys.network(inet '192.168.1.5/24') 192.168.1.0/24
sys.right_shift(inet, inet) boolean contains sys.right_shift(inet '192.168.1/24', inet '192.168.1.5') true
sys.right_shift_assign(inet, inet) boolean contains or equals sys.right_shift_assign(inet '192.168.1/24', inet '192.168.1/24') true
sys.setmasklen(inet, int) inet set netmask length for inet value sys.setmasklen(inet '192.168.1.5/24', 16) 192.168.1.5/16
sys.text(inet) clob extract IP address and netmask length as text sys.text(inet '192.168.1.5') 192.168.1.5/32