PostgreSQL: Using and installing the IP4R extension

The IP4R extension is natively available in Google Cloud SQL and AWS RedShift. To get started, you can run:

CREATE EXTENSION ip4r;

Verifying extension availability

To verify if you have the extension available in your environment you can run the following:

SELECT *
FROM pg_available_extensions
WHERE name='ip4r';

Or, running the CREATE EXTENSION ip4r; will give you a non-consequential error message.

Installing extension in environment

If the extension is not available, you need to install it from GitHub (documentation on the installation process).

git clone https://github.com/RhodiumToad/ip4r.git
cd ip4r
make
make install

Then you can run the following command:

CREATE EXTENSION ip4r;
2 Likes