PostgreSQL - HyperLogLog extension not found

597 Views Asked by At

Can someone explain in a better way (well, in a way for dummies to understand), or more correctly how to install HyperLogLog hll extension for PostgreSQL on my Mac M1 machine.

When running CREATE EXTENSION hll;

I get:

Query 1 ERROR: ERROR: could not open extension control file "/opt/homebrew/share/postgresql/extension/hll.control": No such file or directory

I am new at this, so this documentation https://github.com/citusdata/postgresql-hll did not helped me a lot.

I installed all other extensions that I need except this one..

When typing which postgres I get:

/opt/homebrew/bin/postgres

And version: postgres (PostgreSQL) 14.3

I saw about configuring PG_CONFIG but I do not understand what exactly I should be doing here?

I will appreciate the help and I hope that this post will be of use for other dummies as I. :)

2

There are 2 best solutions below

0
On

We can simplify the script above and execute it inline by copying and pasting all of the following into your terminal:

> yes |
#!/bin/bash

# download latest release
curl -s https://api.github.com/repos/citusdata/postgresql-hll/releases/latest \
| grep '"tarball_url":' \
| sed -E 's/.*"([^"]+)".*/\1/' \
| xargs curl -o package.tar.gz -L

# extract to new hll directory
mkdir hll && tar xf package.tar.gz -C hll --strip-components 1

# build and install extension to postgres extensions folder
cd hll
make
make install

# remove hll directory
cd ../
rm -r ./hll

# connect to PostgreSQL and install extension
psql -U postgres -c "CREATE EXTENSION hll;"
0
On

I wrote the script for myself to get the last package and install it. I build it by using make.

# check if Makefile installed
make -v

# download latest release
curl -s https://api.github.com/repos/citusdata/postgresql-hll/releases/latest \
| grep '"tarball_url":' \
| sed -E 's/.*"([^"]+)".*/\1/' \
| xargs curl -o package.tar.gz -L 

# extract to hll directory
mkdir hll && tar xf package.tar.gz -C hll --strip-components 1

cd hll

# build and instll extension to postgres extensions folder
make 
make install


# remove hll directory
cd ../
rm -r ./hll

# connect to PostgreSQL
psql -U postgres 

# install extension in your DB
CREATE EXTENSION hll;