EnterpriseDB / mysql_fdw

PostgreSQL foreign data wrapper for MySQL
Other
538 stars 162 forks source link

fdw not supported Chinese #2

Open huiflyy opened 13 years ago

huiflyy commented 13 years ago

query the foreign table contains Chinese content, shows '????'

mysql 5.0.77 utf8 postgresql 9.1 utf8

papazis commented 11 years ago

I am using version 1.0.1 of mysql_fdw and have run on the same problem with Greek I have solved the problem by editing the source file mysql_fdw.c and adding right before each

mysql_real_connect()

the following commands mysql_options(conn, MYSQL_SET_CHARSET_NAME, "utf8"); mysql_options(conn, MYSQL_INIT_COMMAND, "SET NAMES utf8");

It is a simple solution that works fine if all of your databases, that you are going to connect to, are UTF8.

papazis commented 11 years ago

--- mysql_fdw.c.orig 2013-02-03 16:34:32.000000000 +0200 +++ mysql_fdw.c 2013-03-07 16:23:33.000000000 +0200 @@ -422,6 +422,9 @@ errmsg("failed to initialise the MySQL connection object") ));

tom10271 commented 1 month ago

In case anyone cannot get Chinese supported, the working settings for us is character_set 'utf8' but not character_set 'utf8mb4' etc.

CREATE SERVER mysql_rds FOREIGN DATA WRAPPER mysql_fdw OPTIONS (host 'my-rds.us-west-2.rds.amazonaws.com', port '3306', character_set 'utf8');