ip4r
IPv4/v6 and IPv4/v6 range index type for PostgreSQL
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
ip4r | 2.4.3 | TYPE | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 3770 | ip4r | No | Yes | No | Yes | No | Yes | - |
| Related | prefix geoip postgis uri nominatim_fdw pg_sphere earthdistance q3c |
|---|---|
| Depended By | geoip |
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PGDG | 2.4.3 | 1817161514 | ip4r | - |
| RPM | PGDG | 2.4.3 | 1817161514 | ip4r_$v | - |
| DEB | PGDG | 2.4.3 | 1817161514 | postgresql-$v-ip4r | - |
Install
You can install ip4r directly. First, make sure the PGDG repository is added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Create Extension:
Usage
The ip4r extension provides specialized data types for IPv4/IPv6 addresses and ranges with superior indexing for containment queries.
Data Types
| Type | Description |
|---|---|
ip4 | Single IPv4 address (32-bit) |
ip6 | Single IPv6 address (dual 64-bit) |
ip4r | IPv4 address range |
ip6r | IPv6 address range |
ipaddress | Mixed IPv4/IPv6 address |
iprange | Mixed IPv4/IPv6 range |
Address Input
Address Operators
- Comparison:
=,<>,<,>,<=,>= - Arithmetic:
+,-with integers - Bitwise:
&(AND),|(OR),#(XOR),~(NOT)
Address Functions
Range Operators
| Operator | Description |
|---|---|
>>= | Contains or equal |
>> | Strictly contains |
<<= | Contained in or equal |
<< | Strictly contained in |
&& | Overlaps |
Range Functions
Indexing
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)