Page 1 of 1

ENUM is treated differently in MySQL and MariaDB

Posted: Wed 07 Oct 2015 03:30
by waheed
When you add fields to the field editor (you know, right click on Query component and select Fields Editor, then add all) Field definition is different between MySQL and MariaDB for EMUM columns.
I'm not talking about straight field mapping of ENUMs, but I'm talking about when you want the integer value of the ENUM, so you add 0 to it.
Here is the table creation

Code: Select all

CREATE TABLE `enumtest` (
	`enumfield` ENUM('Y','N') NULL DEFAULT NULL
)
COLLATE='utf8_general_ci'
ENGINE=MyISAM;
and here is the select statement:

Code: Select all

select enumfield, (enumfield+0) as enumfieldI from enumtest
The problem is in mapping (enumfield+0)
in mysql it is mapped to Float, and in MariaDB it is mapped to Largeint

I think this is a BUG!

NOTE 1: I know many are against using ENUM all together. But till I have time to change, I need this fixed.
NOTE 2: I know I can do field mapping and force both of them to integer.

Re: ENUM is treated differently in MySQL and MariaDB

Posted: Wed 07 Oct 2015 14:37
by ViktorV
MariaDB returns the MYSQL_TYPE_LONGLONG type for the specified column. And MySQL server returns MYSQL_TYPE_DOUBLE. And using this data, we create corresponding fields. If you want to create an Integer field for this column, you should use data type mapping.

Re: ENUM is treated differently in MySQL and MariaDB

Posted: Wed 07 Oct 2015 14:43
by waheed
Thanks, that is what I did "Field Mapping".
Therefore MariaDB does NOT EQUAL MySQL.

Re: ENUM is treated differently in MySQL and MariaDB

Posted: Wed 07 Oct 2015 14:52
by ViktorV
If you have any questions during using our products, please don't hesitate to contact us - and we will try to help you solve them.