alitrack / duckdb_fdw

DuckDB Foreign Data Wrapper for PostgreSQL
MIT License
289 stars 18 forks source link

Can't find $libdir/duckdb_fdw #2

Closed nestarz closed 3 years ago

nestarz commented 3 years ago

Hello,

I am trying to install the extension using this Dockerfile:

FROM postgres

RUN apt-get update && apt-get install -y \
  git \
  build-essential \
  cmake

RUN git clone https://github.com/cwida/duckdb.git \
  && cd duckdb \
  && make

RUN apt-get install -y postgresql-server-dev-13
ENV PATH="/usr/include/postgresql/13/server/:${PATH}"

RUN git clone https://github.com/alitrack/duckdb_fdw.git  \
   && cd duckdb_fdw \
   && cp -R /duckdb/build/release/tools/sqlite3_api_wrapper/* .  \
   && cp -R /duckdb/tools/sqlite3_api_wrapper/include/* .  \
   && make USE_PGXS=1 \
   && make install USE_PGXS=1

RUN cp -R duckdb_fdw/* /usr/share/postgresql/13/extension/
RUN cp -R duckdb_fdw/sql/* /usr/share/postgresql/13/extension/

COPY ./db.sql /docker-entrypoint-initdb.d/

db.sql

CREATE EXTENSION duckdb_fdw;
CREATE SERVER DuckDB_server FOREIGN DATA WRAPPER duckdb_fdw OPTIONS (database '/tmp/test.db');

But then I have this error when I run PostgreSQL:

2021-01-24 15:28:42.387 UTC [47] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-01-24 15:28:42.401 UTC [48] LOG:  database system was shut down at 2021-01-24 15:28:41 UTC
2021-01-24 15:28:42.414 UTC [47] LOG:  database system is ready to accept connections
2021-01-24 15:28:43.233 UTC [91] ERROR:  could not access file "$libdir/duckdb_fdw": No such file or directory
2021-01-24 15:28:43.233 UTC [91] STATEMENT:  CREATE EXTENSION duckdb_fdw;

May I know how can I install the extension properly ? Thanks !

nestarz commented 3 years ago

After make install, the extension files are not placed into the right directory, nothing seems to happen in fact, I need to manually copy them, but still where is the duckdb_fdw I need to copy to $libdir ?

nestarz commented 3 years ago

Made it work by only copying the required files:

FROM postgres

RUN apt-get update && apt-get install -y \
  git \
  build-essential \
  cmake

RUN git clone https://github.com/cwida/duckdb.git \
  && cd duckdb \
  && make

RUN apt-get install -y postgresql-server-dev-13 postgresql-client-13

RUN git clone https://github.com/alitrack/duckdb_fdw.git  \
   && cd duckdb_fdw \
   && cp /duckdb/build/release/tools/sqlite3_api_wrapper/libsqlite3_api_wrapper.so $(pg_config --libdir)  \
   && cp /duckdb/tools/sqlite3_api_wrapper/include/sqlite3.h .  \
   && make USE_PGXS=1 \
   && make install USE_PGXS=1 \
   && cd .. && rm -rf duckdb_fdw duckdb

ENV POSTGRES_HOST_AUTH_METHOD='trust'