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

Hi,
I’m trying to create the extension pg_similarity (https://github.com/eulerto/pg_similarity) in a docker container.
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?

On 03/16/2018 03:18 PM, hmidi slim wrote:
> Hi,
> I’m trying to create the extension pg_similarity 
> <https://github.com/eulerto/pg_similarity> 
> (https://github.com/eulerto/pg_similarity) in a docker container.
> Dockerfile:
> 
> |FROMpostgres:10ENV POSTGRES_USER userENV POSTGRES_PASSWORD userENV 
> 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 
> <http://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"forhelp.user_db=#createextension pg_similarity;|
> 
> 
> I got this error:
> 
> |ERROR:could notopenextension control 
> file"/usr/share/postgresql/10/extension/pg_similarity.control":No such 
> fileordirectory|
> 
> 
> Under |/usr/share/postgres/10/contrib| I find the file 
> pg_similarity.sql.How can I fix this problem?

But do you see pg_similarity.control which what the error is complaining 
about?


> 
> 
> |
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com


I didn't find the file pg_similarity.control when I run find / -name 'pg_similarity.control' 2> /dev/null
On 03/17/2018 03:03 AM, hmidi slim wrote:
> I didn't find the file pg_similarity.control when I run find / -name 
> 'pg_similarity.control' 2> /dev/null

In your original post you use the file from pgFoundry:

pgfoundry.org/frs/download.php/2237/pg_similarity-0.0.19.tgz

When I installed from that file I got:

/usr/bin/mkdir -p '/usr/local/pgsql10/lib64'
/usr/bin/mkdir -p '/usr/local/pgsql10/share/contrib'
/usr/bin/install -c -m 755  pg_similarity.so 
'/usr/local/pgsql10/lib64/pg_similarity.so'
/usr/bin/install -c -m 644 .//uninstall_pg_similarity.sql 
pg_similarity.sql '/usr/local/pgsql10/share/contrib/'

Note no pg_similarity.control and also it did not install to 
~/share/extension but to ~/share/contrib.

 From here:

https://github.com/eulerto/pg_similarity

The latest version is 1.0 not 0.0.19. I did:

git clone https://github.com/eulerto/pg_similarity.git

and then ran the make process and got:

/usr/bin/mkdir -p '/usr/local/pgsql10/lib64'
/usr/bin/mkdir -p '/usr/local/pgsql10/share/extension'
/usr/bin/mkdir -p '/usr/local/pgsql10/share/extension'
/usr/bin/install -c -m 755  pg_similarity.so 
'/usr/local/pgsql10/lib64/pg_similarity.so'
/usr/bin/install -c -m 644 .//pg_similarity.control 
'/usr/local/pgsql10/share/extension/'
/usr/bin/install -c -m 644 .//pg_similarity--1.0.sql 
.//pg_similarity--unpackaged--1.0.sql pg_similarity.sql 
'/usr/local/pgsql10/share/extension/'


The pg_similarity.control was installed and the extension was installed 
in ~/share/extension.

More importantly I could CREATE the extension:

test=# CREATE EXTENSION pg_similarity;
CREATE EXTENSION




-- 
Adrian Klaver
adrian.klaver@aklaver.com