1

MySQL に反映する必要がある Postgres のテーブルがあります。このhttp://wiki.postgresql.org/wiki/Foreign_data_wrapper#mysql_fdwを見つけましたが、実際に MySQL にリンクする方法は非常に不明確です。CREATE FOREIGN TABLE は Postgres では機能しますが、MySQL では構文エラーです。すべての CREATE FOREIGN TABLE を実行し、Postgres で CREATE SERVER mysql_svr を作成した後、MySQL に魔法のようにデータが表示されないため、ステップが欠落している必要があります。

mysql> CREATE FOREIGN TABLE ex_staff ( id integer, name text, address text) SERVER mysql_svr OPTIONS (query ‘SELECT * FROM hr.employees WHERE date_left IS NOT NULL’);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FOREIGN TABLE ex_staff ( id integer, name text, address text) SERVER mysql_svr O' at line 1
4

1 に答える 1

2

やぁ…

OPTIONS (
    database 'myplace',
    schema 'test', 
    table 'dblist', 
    sql_query 'select description,id,name,created_datetime,sd,users from `test`.`dblist`',
    sql_count 'select count(id) from `test`.`dblist`',
    db_id 'id', 
    db_name 'name',
    db_desc 'description',
    db_users 'users',
    db_createdtime 'created_datetime'
);
于 2013-09-23T08:25:25.180 に答える