Given a MySQL table like this:
create table the_table (
the_field set('x', 'y', 'z')
);
When trying to import its schema like this:
import foreign schema the_foreign_schema
from server the_server
into the_schema
options (
import_enum_as_text 'true'
);
The entire table is skipped citing "skipping import for relation".
This seems to be the only 1 MySQL type that mysql_fdw treats this way; the mysql_fdw.c at line 2370 says:
"PostgreSQL does not have an equivalent data type to map with SET, so skip the table definitions for the ones having SET type column."
However, Postgres has the native TEXT[] type which should be fully capable of directly mapping with a MySQL SET, and mysql_fdw can use it same as it maps MySQL ENUM to TEXT now, at least when enabled via import_enum_as_text.
This is a request to formally support MySQL SET mapped with Postgres TEXT[] so that imports of SET can succeed and be useful.
For consistency, this could be gated behind an option like import_set_as_text_array or such, or you could overload import_enum_as_text to also have that behaviour, since the 2 features are closely related.
Without this change, the current behaviour of mysql_fdw causes a real problem for me and others as it means I can not fully access an existing MySQL schema from Postgres and it would be onerous to change the MySQL schema to use something other than SET as it is a legacy application still used in production.
I recognize that technically SET is an unordered type while TEXT[] is ordered, but for all practical purposes that shouldn't be a problem to map them. The TEXT[] can be semantically treated as containing an unordered set anyway. But to ensure correct behaviour the mapping could also sort the values lexicographically to guarantee that 2 equal SET map to 2 equal TEXT[] deterministically. And going the other way is ordered to unordered.
Making this change would address a low hanging fruit for obvious missing functionality that in theory should be very little implementation effort to someone expert in maintaining it.
Thank you in advance for your consideration.
Given a MySQL table like this:
create table the_table (
the_field set('x', 'y', 'z')
);
When trying to import its schema like this:
import foreign schema the_foreign_schema
from server the_server
into the_schema
options (
import_enum_as_text 'true'
);
The entire table is skipped citing "skipping import for relation".
This seems to be the only 1 MySQL type that mysql_fdw treats this way; the mysql_fdw.c at line 2370 says:
"PostgreSQL does not have an equivalent data type to map with SET, so skip the table definitions for the ones having SET type column."
However, Postgres has the native TEXT[] type which should be fully capable of directly mapping with a MySQL SET, and mysql_fdw can use it same as it maps MySQL ENUM to TEXT now, at least when enabled via import_enum_as_text.
This is a request to formally support MySQL SET mapped with Postgres TEXT[] so that imports of SET can succeed and be useful.
For consistency, this could be gated behind an option like import_set_as_text_array or such, or you could overload import_enum_as_text to also have that behaviour, since the 2 features are closely related.
Without this change, the current behaviour of mysql_fdw causes a real problem for me and others as it means I can not fully access an existing MySQL schema from Postgres and it would be onerous to change the MySQL schema to use something other than SET as it is a legacy application still used in production.
I recognize that technically SET is an unordered type while TEXT[] is ordered, but for all practical purposes that shouldn't be a problem to map them. The TEXT[] can be semantically treated as containing an unordered set anyway. But to ensure correct behaviour the mapping could also sort the values lexicographically to guarantee that 2 equal SET map to 2 equal TEXT[] deterministically. And going the other way is ordered to unordered.
Making this change would address a low hanging fruit for obvious missing functionality that in theory should be very little implementation effort to someone expert in maintaining it.
Thank you in advance for your consideration.