geoip
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
geoip | 0.3.0 | GIS | BSD-2-Clause | SQL |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 1560 | geoip | No | Yes | No | Yes | No | No | geoip |
no pg17 on el9, no legacy branch on el8
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | MIXED | 0.3.0 | 1817161514 | geoip | ip4r |
| RPM | PIGSTY | 0.3.0 | 1817161514 | geoip_$v | - |
| DEB | PIGSTY | 0.3.0 | 1817161514 | postgresql-$v-geoip | - |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.3.0 el8.x86_64.pg18 : geoip_18 geoip_18-0.3.0-1PIGSTY.el8.x86_64.rpm
| PIGSTY 0.3.0 el8.x86_64.pg17 : geoip_17 geoip_17-0.3.0-1PIGSTY.el8.x86_64.rpm
| PIGSTY 0.3.0 el8.x86_64.pg16 : geoip_16 geoip_16-0.3.0-1PIGSTY.el8.x86_64.rpm
| PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| el8.aarch64 | PIGSTY 0.3.0 el8.aarch64.pg18 : geoip_18 geoip_18-0.3.0-1PIGSTY.el8.aarch64.rpm
| PIGSTY 0.3.0 el8.aarch64.pg17 : geoip_17 geoip_17-0.3.0-1PIGSTY.el8.aarch64.rpm
| PIGSTY 0.3.0 el8.aarch64.pg16 : geoip_16 geoip_16-0.3.0-1PIGSTY.el8.aarch64.rpm
| PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| el9.x86_64 | PIGSTY 0.3.0 el9.x86_64.pg18 : geoip_18 geoip_18-0.3.0-1PIGSTY.el9.x86_64.rpm
| PIGSTY 0.3.0 el9.x86_64.pg17 : geoip_17 geoip_17-0.3.0-1PIGSTY.el9.x86_64.rpm
| PIGSTY 0.3.0 el9.x86_64.pg16 : geoip_16 geoip_16-0.3.0-1PIGSTY.el9.x86_64.rpm
| PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| el9.aarch64 | PIGSTY 0.3.0 el9.aarch64.pg18 : geoip_18 geoip_18-0.3.0-1PIGSTY.el9.aarch64.rpm
| PIGSTY 0.3.0 el9.aarch64.pg17 : geoip_17 geoip_17-0.3.0-1PIGSTY.el9.aarch64.rpm
| PIGSTY 0.3.0 el9.aarch64.pg16 : geoip_16 geoip_16-0.3.0-1PIGSTY.el9.aarch64.rpm
| PIGSTY 0.3.0 | PIGSTY 0.3.0 |
| el10.x86_64 | PIGSTY 0.3.0 el10.x86_64.pg18 : geoip_18 geoip_18-0.3.0-1PIGSTY.el10.x86_64.rpm
| PIGSTY 0.3.0 el10.x86_64.pg17 : geoip_17 geoip_17-0.3.0-1PIGSTY.el10.x86_64.rpm
| PIGSTY 0.3.0 el10.x86_64.pg16 : geoip_16 geoip_16-0.3.0-1PIGSTY.el10.x86_64.rpm
| PIGSTY 0.3.0 el10.x86_64.pg15 : geoip_15 geoip_15-0.3.0-1PIGSTY.el10.x86_64.rpm
| PIGSTY 0.3.0 el10.x86_64.pg14 : geoip_14 geoip_14-0.3.0-1PIGSTY.el10.x86_64.rpm
|
| el10.aarch64 | PIGSTY 0.3.0 el10.aarch64.pg18 : geoip_18 geoip_18-0.3.0-1PIGSTY.el10.aarch64.rpm
| PIGSTY 0.3.0 el10.aarch64.pg17 : geoip_17 geoip_17-0.3.0-1PIGSTY.el10.aarch64.rpm
| PIGSTY 0.3.0 el10.aarch64.pg16 : geoip_16 geoip_16-0.3.0-1PIGSTY.el10.aarch64.rpm
| PIGSTY 0.3.0 el10.aarch64.pg15 : geoip_15 geoip_15-0.3.0-1PIGSTY.el10.aarch64.rpm
| PIGSTY 0.3.0 el10.aarch64.pg14 : geoip_14 geoip_14-0.3.0-1PIGSTY.el10.aarch64.rpm
|
| d12.x86_64 | PIGSTY 0.3.0 d12.x86_64.pg18 : postgresql-18-geoip postgresql-18-geoip_0.3.0-1PIGSTY~bookworm_amd64.deb
| PIGSTY 0.3.0 d12.x86_64.pg17 : postgresql-17-geoip postgresql-17-geoip_0.3.0-1PIGSTY~bookworm_amd64.deb
| PIGSTY 0.3.0 d12.x86_64.pg16 : postgresql-16-geoip postgresql-16-geoip_0.3.0-1PIGSTY~bookworm_amd64.deb
| PIGSTY 0.3.0 d12.x86_64.pg15 : postgresql-15-geoip postgresql-15-geoip_0.3.0-1PIGSTY~bookworm_amd64.deb
| PIGSTY 0.3.0 d12.x86_64.pg14 : postgresql-14-geoip postgresql-14-geoip_0.3.0-1PIGSTY~bookworm_amd64.deb
|
| d12.aarch64 | PIGSTY 0.3.0 d12.aarch64.pg18 : postgresql-18-geoip postgresql-18-geoip_0.3.0-1PIGSTY~bookworm_arm64.deb
| PIGSTY 0.3.0 d12.aarch64.pg17 : postgresql-17-geoip postgresql-17-geoip_0.3.0-1PIGSTY~bookworm_arm64.deb
| PIGSTY 0.3.0 d12.aarch64.pg16 : postgresql-16-geoip postgresql-16-geoip_0.3.0-1PIGSTY~bookworm_arm64.deb
| PIGSTY 0.3.0 d12.aarch64.pg15 : postgresql-15-geoip postgresql-15-geoip_0.3.0-1PIGSTY~bookworm_arm64.deb
| PIGSTY 0.3.0 d12.aarch64.pg14 : postgresql-14-geoip postgresql-14-geoip_0.3.0-1PIGSTY~bookworm_arm64.deb
|
| d13.x86_64 | PIGSTY 0.3.0 d13.x86_64.pg18 : postgresql-18-geoip postgresql-18-geoip_0.3.0-1PIGSTY~trixie_amd64.deb
| PIGSTY 0.3.0 d13.x86_64.pg17 : postgresql-17-geoip postgresql-17-geoip_0.3.0-1PIGSTY~trixie_amd64.deb
| PIGSTY 0.3.0 d13.x86_64.pg16 : postgresql-16-geoip postgresql-16-geoip_0.3.0-1PIGSTY~trixie_amd64.deb
| PIGSTY 0.3.0 d13.x86_64.pg15 : postgresql-15-geoip postgresql-15-geoip_0.3.0-1PIGSTY~trixie_amd64.deb
| PIGSTY 0.3.0 d13.x86_64.pg14 : postgresql-14-geoip postgresql-14-geoip_0.3.0-1PIGSTY~trixie_amd64.deb
|
| d13.aarch64 | PIGSTY 0.3.0 d13.aarch64.pg18 : postgresql-18-geoip postgresql-18-geoip_0.3.0-1PIGSTY~trixie_arm64.deb
| PIGSTY 0.3.0 d13.aarch64.pg17 : postgresql-17-geoip postgresql-17-geoip_0.3.0-1PIGSTY~trixie_arm64.deb
| PIGSTY 0.3.0 d13.aarch64.pg16 : postgresql-16-geoip postgresql-16-geoip_0.3.0-1PIGSTY~trixie_arm64.deb
| PIGSTY 0.3.0 d13.aarch64.pg15 : postgresql-15-geoip postgresql-15-geoip_0.3.0-1PIGSTY~trixie_arm64.deb
| PIGSTY 0.3.0 d13.aarch64.pg14 : postgresql-14-geoip postgresql-14-geoip_0.3.0-1PIGSTY~trixie_arm64.deb
|
| u22.x86_64 | PIGSTY 0.3.0 u22.x86_64.pg18 : postgresql-18-geoip postgresql-18-geoip_0.3.0-1PIGSTY~jammy_amd64.deb
| PIGSTY 0.3.0 u22.x86_64.pg17 : postgresql-17-geoip postgresql-17-geoip_0.3.0-1PIGSTY~jammy_amd64.deb
| PIGSTY 0.3.0 u22.x86_64.pg16 : postgresql-16-geoip postgresql-16-geoip_0.3.0-1PIGSTY~jammy_amd64.deb
| PIGSTY 0.3.0 u22.x86_64.pg15 : postgresql-15-geoip postgresql-15-geoip_0.3.0-1PIGSTY~jammy_amd64.deb
| PIGSTY 0.3.0 u22.x86_64.pg14 : postgresql-14-geoip postgresql-14-geoip_0.3.0-1PIGSTY~jammy_amd64.deb
|
| u22.aarch64 | PIGSTY 0.3.0 u22.aarch64.pg18 : postgresql-18-geoip postgresql-18-geoip_0.3.0-1PIGSTY~jammy_arm64.deb
| PIGSTY 0.3.0 u22.aarch64.pg17 : postgresql-17-geoip postgresql-17-geoip_0.3.0-1PIGSTY~jammy_arm64.deb
| PIGSTY 0.3.0 u22.aarch64.pg16 : postgresql-16-geoip postgresql-16-geoip_0.3.0-1PIGSTY~jammy_arm64.deb
| PIGSTY 0.3.0 u22.aarch64.pg15 : postgresql-15-geoip postgresql-15-geoip_0.3.0-1PIGSTY~jammy_arm64.deb
| PIGSTY 0.3.0 u22.aarch64.pg14 : postgresql-14-geoip postgresql-14-geoip_0.3.0-1PIGSTY~jammy_arm64.deb
|
| u24.x86_64 | PIGSTY 0.3.0 u24.x86_64.pg18 : postgresql-18-geoip postgresql-18-geoip_0.3.0-1PIGSTY~noble_amd64.deb
| PIGSTY 0.3.0 u24.x86_64.pg17 : postgresql-17-geoip postgresql-17-geoip_0.3.0-1PIGSTY~noble_amd64.deb
| PIGSTY 0.3.0 u24.x86_64.pg16 : postgresql-16-geoip postgresql-16-geoip_0.3.0-1PIGSTY~noble_amd64.deb
| PIGSTY 0.3.0 u24.x86_64.pg15 : postgresql-15-geoip postgresql-15-geoip_0.3.0-1PIGSTY~noble_amd64.deb
| PIGSTY 0.3.0 u24.x86_64.pg14 : postgresql-14-geoip postgresql-14-geoip_0.3.0-1PIGSTY~noble_amd64.deb
|
| u24.aarch64 | PIGSTY 0.3.0 u24.aarch64.pg18 : postgresql-18-geoip postgresql-18-geoip_0.3.0-1PIGSTY~noble_arm64.deb
| PIGSTY 0.3.0 u24.aarch64.pg17 : postgresql-17-geoip postgresql-17-geoip_0.3.0-1PIGSTY~noble_arm64.deb
| PIGSTY 0.3.0 u24.aarch64.pg16 : postgresql-16-geoip postgresql-16-geoip_0.3.0-1PIGSTY~noble_arm64.deb
| PIGSTY 0.3.0 u24.aarch64.pg15 : postgresql-15-geoip postgresql-15-geoip_0.3.0-1PIGSTY~noble_arm64.deb
| PIGSTY 0.3.0 u24.aarch64.pg14 : postgresql-14-geoip postgresql-14-geoip_0.3.0-1PIGSTY~noble_arm64.deb
|
| u26.x86_64 | PIGSTY 0.3.0 u26.x86_64.pg18 : postgresql-18-geoip postgresql-18-geoip_0.3.0-1PIGSTY~resolute_amd64.deb
| PIGSTY 0.3.0 u26.x86_64.pg17 : postgresql-17-geoip postgresql-17-geoip_0.3.0-1PIGSTY~resolute_amd64.deb
| PIGSTY 0.3.0 u26.x86_64.pg16 : postgresql-16-geoip postgresql-16-geoip_0.3.0-1PIGSTY~resolute_amd64.deb
| PIGSTY 0.3.0 u26.x86_64.pg15 : postgresql-15-geoip postgresql-15-geoip_0.3.0-1PIGSTY~resolute_amd64.deb
| PIGSTY 0.3.0 u26.x86_64.pg14 : postgresql-14-geoip postgresql-14-geoip_0.3.0-1PIGSTY~resolute_amd64.deb
|
| u26.aarch64 | PIGSTY 0.3.0 u26.aarch64.pg18 : postgresql-18-geoip postgresql-18-geoip_0.3.0-1PIGSTY~resolute_arm64.deb
| PIGSTY 0.3.0 u26.aarch64.pg17 : postgresql-17-geoip postgresql-17-geoip_0.3.0-1PIGSTY~resolute_arm64.deb
| PIGSTY 0.3.0 u26.aarch64.pg16 : postgresql-16-geoip postgresql-16-geoip_0.3.0-1PIGSTY~resolute_arm64.deb
| PIGSTY 0.3.0 u26.aarch64.pg15 : postgresql-15-geoip postgresql-15-geoip_0.3.0-1PIGSTY~resolute_arm64.deb
| PIGSTY 0.3.0 u26.aarch64.pg14 : postgresql-14-geoip postgresql-14-geoip_0.3.0-1PIGSTY~resolute_arm64.deb
|
Build
You can build the RPM / DEB packages for geoip using pig build:
Install
You can install geoip directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
This extension provides IP-based geolocation — you provide an IPv4 or IPv6 address and the extension looks up country, city, GPS coordinates, ASN and more. It requires the ip4r extension and GeoLite2 data from MaxMind.
Functions
| Function | Description |
|---|---|
geoip_country_code(ip4|ip6) | Returns country code (2 chars) |
geoip_country(ip4|ip6) | Returns all country info (code, name, network) |
geoip_city_location(ip4|ip6) | Returns just the location ID (INT) |
geoip_city(ip4|ip6) | Returns all city info (GPS, ZIP code, etc.) |
geoip_asn(ip4|ip6) | Returns ASN name and IP range |
Examples
Loading Data
The extension requires GeoLite2 CSV data from MaxMind. Download the City, Country, and ASN datasets in CSV format from MaxMind GeoLite2, then load:
The “locations” files have multiple language variants — pick the one that works for you.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)