eulerto/pg_similarity

Could not open extension control file “/usr/share/postgresql/10/extension/pg_similarity.control”: No such file or directory

slim-hmidi opened this issue · 2 comments

I’m trying to create the extension pg_smiliarity in docker container. I create this Dockerfile:

FROM postgres:10

ENV POSTGRES_USER user
ENV POSTGRES_PASSWORD user
ENV POSTGRES_DB user_db

RUN apt-get update \
    && apt-get upgrade -y \
    && apt-get -y install \
     postgresql-server-dev-all \
     wget \
     make \
     gcc \
    && rm -rf /var/lib/apt/lists/*
RUN wget -c 'pgfoundry.org/frs/download.php/2237/pg_similarity-0.0.19.tgz' 
RUN tar -zxf pg_similarity-0.0.19.tgz
RUN cd pg_similarity \
    && USE_PGXS=1 make \
    && USE_PGXS=1 make install

Then I build the image and I run the container. I exec into the container:

psql -U user -d user_db
psql (10.3 (Debian 10.3-1.pgdg90+1))
 Type "help" for help.
user_db=# create extension pg_similarity;

I got this error:

ERROR: could not open extension control file "/usr/share/postgresql/10/extension/pg_similarity.control": No such file or directory

Under '/usr/share/postgres/10/contrib' I find the file pg_similarity.sql.How can I fix this problem?

@slim-hmidi Don't use pgFoundry (its usage was discontinued) because it contains an old release. Instead use GitHub. I added a new release to it.

@eulerto I have the same error when using code from git repo or from your release archive https://github.com/eulerto/pg_similarity/archive/refs/tags/pg_similarity_1_0.tar.gz with PG 13 for make docker image

Dockerfile:

FROM postgres:13.14-bullseye

RUN apt-get update && apt-get -y install wget make gcc postgresql-contrib postgresql-server-dev-all 
	
RUN wget -c 'https://github.com/eulerto/pg_similarity/archive/refs/tags/pg_similarity_1_0.tar.gz' 
RUN tar -zxf pg_similarity_1_0.tar.gz
WORKDIR pg_similarity-pg_similarity_1_0
RUN USE_PGXS=1 make
RUN USE_PGXS=1 make install

COPY init-db.sh /docker-entrypoint-initdb.d/init-db.sh

RUN chmod +x /docker-entrypoint-initdb.d/init-db.sh

init-db.sh:

#!/bin/bash
set -e

psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
    CREATE EXTENSION pg_similarity;
EOSQL