EnterpriseDB / mysql_fdw

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

Missing types mapping #97

Open aegir-fr opened 8 years ago

aegir-fr commented 8 years ago

Hi,

Missing "float unsigned" and "longblob".

In my copy of mysql_fdw.c I needed to add :

WHEN c.DATA_TYPE = 'longblob' THEN 'bytea' WHEN c.DATA_TYPE = 'float unsigned' THEN 'real'

Maybe it'd be better to add also some warnings about bytea's maxlength wich is less than longblob...

ahsanhadi commented 8 years ago

We will add support this datatype mapping...

KES777 commented 8 years ago

When the source mysql column was defined as:

`type` set('content','catalog','gallery') NOT NULL,

IMPORT FOREIGN SCHEMA tryes:

type set NOT NULL,

Also when you try to CREATE TYPE for column of SET type it is better to prefix with table name:

DO $$BEGIN IF NOT EXISTS (SELECT 1 FROM pg_catalog.pg_type WHERE typname = 'type_t') THEN CREATE TYPE type_t AS enum('SOA','NS','A','MX','TXT','SRV','CNAME'); END IF; END$$;
DO $$BEGIN IF NOT EXISTS (SELECT 1 FROM pg_catalog.pg_type WHERE typname = 'type_t') THEN CREATE TYPE type_t AS enum('debit','credit'); END IF; END$$;

So instead of 'type_t' you get: dns_type_t, card_type_t this will escape from conflicts.

*for reference