EnterpriseDB / mysql_fdw

PostgreSQL foreign data wrapper for MySQL
Other
520 stars 160 forks source link

Unable to install the extensions #304

Open AzmathShaik1210 opened 1 month ago

AzmathShaik1210 commented 1 month ago

https://github.com/EnterpriseDB/mysql_fdw/issues/301

Self-hosted I'm trying to access the my DB (MySQL) from postgres through supabase

Below are the work-around I have done with installing fdw

CREATE SERVER mysql_server FOREIGN DATA WRAPPER mysql_fdw OPTIONS (host 'my-host', port '3306', dbname 'my-db-name');

ERROR: foreign-data wrapper "mysql_fdw" does not exist

My postgres version postgres (PostgreSQL) 15.1 (Ubuntu 15.1-1.pgdg20.04+1)

root@IP:/# apt-get install postgresql15-mysql-fdw Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package postgresql15-mysql-fdw

I tried to install with postgres9.5 root@IP:/# apt-get install postgresql-9.5-mysql-fdw Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package postgresql-9.5-mysql-fdw E: Couldn't find any package by glob 'postgresql-9.5-mysql-fdw' E: Couldn't find any package by regex 'postgresql-9.5-mysql-fdw'

I logged-in into my postgres and tried to create mysql_fdw extension postgres=> CREATE EXTENSION mysql_fdw; ERROR: extension "mysql_fdw" is not available DETAIL: Could not open extension control file "/usr/share/postgresql/15/extension/mysql_fdw.control": No such file or directory. HINT: The extension must first be installed on the system where PostgreSQL is running.

When I tried to install make, the below error appears

root@IP:/mysql_fdw# make gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -I/usr/include/mysql -D _MYSQL_LIBNAME=\"libmysqlclient.so\" -I. -I./ -I/usr/include/postgresql/15/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -c -o connection.o connection.c connection.c:15:10: fatal error: postgres.h: No such file or directory 15 | #include "postgres.h" | ^~~~ compilation terminated. make: *** [: connection.o] Error 1

Thanks

surajkharage19 commented 1 month ago

Hi @AzmathShaik1210,

Can you please confirm how you have installed the Postgres server? using RPMs or using source code?

AzmathShaik1210 commented 1 month ago

Hi @surajkharage19 With the help of Supabase docker image.

surajkharage19 commented 1 month ago

Hi @AzmathShaik1210,

As per the supabase docs [1], mysql_fdw is not added into their extension list. I am not sure what needs to be done for the supabase images but you could reach out to request that they should add mysql_fdw in their extensions list.

[1] https://hub.docker.com/r/supabase/postgres

AzmathShaik1210 commented 1 month ago

Hi @surajkharage19,

Thanks for your revert, I will reach out to supabase to add the mysql_fdw extension. If I need any help then I will contact you.

Thanks

aolaog commented 1 month ago

i also cann't create extention mysql_fdw, but the error message occured is not like you ,as below: postgres=# CREATE EXTENSION mysql_fdw; ERROR: failed to load the mysql query: (null) HINT: Export LD_LIBRARY_PATH to locate the library.