Re: PostgreSQL 9.5, mysql_fdw, and IMPORT FOREIGN SCHEMA question

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Deven Phillips <deven(dot)phillips(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: PostgreSQL 9.5, mysql_fdw, and IMPORT FOREIGN SCHEMA question
Date: 2016-01-09 18:23:43
Message-ID: 5691502F.8040507@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 01/08/2016 08:45 PM, Deven Phillips wrote:
> I DID get a foreign table to work using the following:
>
> CREATE FOREIGN TABLE customer (
> id BIGINT,
> name VARCHAR(150),
> parent_id BIGINT,
> oracle_id BIGINT,
> last_updated_time TIMESTAMP,
> created_time TIMESTAMP) SERVER mysql OPTIONS (dbname 'mydb', table_name
> 'customer');
>
> And I was subsequently able to query that table from PostgreSQL..

Yes, dbname is a required option to FOREIGN TABLE:

https://github.com/EnterpriseDB/mysql_fdw
"The following parameters can be set on a MySQL foreign table object:

dbname: Name of the MySQL database to query. This is a mandatory option."

>
> I tried to add the "OPTIONS" to the IMPORT FOREIGN SCHEMA and got an
> error that "dbname" is not a valid parameter.
>
> Thanks,
>
> Deven
>
> On Fri, Jan 8, 2016 at 11:38 PM, Deven Phillips
> <deven(dot)phillips(at)gmail(dot)com <mailto:deven(dot)phillips(at)gmail(dot)com>> wrote:
>
> Apparently not, though I have done so in the past on PostgreSQL 9.4.
> It appears to be related to the "schema" with which the foreign
> table is associated:
>
> mydb=# CREATE FOREIGN TABLE customer (
> id BIGINT,
> name VARCHAR(150),
> parent_id BIGINT,
> oracle_id BIGINT,
> last_updated_time TIMESTAMP,
> created_time TIMESTAMP) SERVER mysql;
> CREATE FOREIGN TABLE
> mydb=# SELECT * FROM customer;
> ERROR: failed to prepare the MySQL query:
> Table 'public.customer' doesn't exist
>
> Any suggestions would be greatly appreciated!
>
> Deven
>
>
> On Fri, Jan 8, 2016 at 10:26 AM, Adrian Klaver
> <adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>> wrote:
>
> On 01/08/2016 07:04 AM, Deven Phillips wrote:
>
> Hi all,
>
> I installed the newly released PostgreSQL 9.5 this
> morning and
> compiled the latest mysql_fdw extension from EnterpriseDB. I
> was able to
> create the SERVER and USER MAPPING, but I cannot seem to get
> IMPORT
> FOREIGN SCHEMA to do anything. The command executes without
> error, but
> none of the table schemas are imported from the MySQL DB.
> Does anyone
> have any advice, links, documentation which might be of help?
>
>
> Can you CREATE FOREIGN TABLE and use it?
>
>
> Thanks in advance!
>
> Deven
>
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message drum.lucas@gmail.com 2016-01-09 20:36:20 Re: New Slave - timeline ERROR
Previous Message bricklen 2016-01-09 17:06:51 Re: New Slave - timeline ERROR