[MDEV-12503] Inconsistent behavior when mixing ENUM+GEOMETRY for functions vs UNION Created: 2017-04-14  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Data types
Affects Version/s: 10.3
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
Labels: None

Epic Link: Data type cleanups

 Description   

Mixing ENUM and GEOMETRY in hybrid functions creates a LONGBLOB column:

DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (a ENUM('a'), b Geometry);
CREATE TABLE t2 AS SELECT LEAST(a,b), COALESCE(a,b) FROM t1;
SHOW CREATE TABLE t2;

+-------+------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                             |
+-------+------------------------------------------------------------------------------------------------------------------------------------------+
| t2    | CREATE TABLE `t2` (
  `LEAST(a,b)` longblob DEFAULT NULL,
  `COALESCE(a,b)` longblob DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+------------------------------------------------------------------------------------------------------------------------------------------+

Mixing ENUM and GEOMETRY for UNION returns an error:

DROP TABLE t2;
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1;

ERROR 4053 (HY000): Illegal parameter data types enum and geometry for operation 'UNION'

It would be nice to have consistent behavior.

The problem is that hybrid functions and UNION treat arguments differently:

  • functions operate in terms of field type and see ENUM as VARCHAR.
  • UNION operates in term of real field type and see ENUM as ENUM.

Perhaps hybrid functions should be fixed to operate in terms of real field type.


Generated at Thu Feb 08 07:58:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.