[MDEV-20332] Wrong UNSIGNED metadata flag returned for COALESCE(unsigned_field,timestamp_field) Created: 2019-08-12  Updated: 2019-08-12  Resolved: 2019-08-12

Status: Closed
Project: MariaDB Server
Component/s: Data types
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.5.0

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

Issue Links:
Blocks
blocks MDEV-4912 Data type plugin API version 1 Closed

 Description   

I run this command

mysql --column-type-info test

and execute the following script:

CREATE OR REPLACE TABLE t1 (a INT UNSIGNED, b TIMESTAMP);
SELECT COALESCE(a,b) FROM t1;

Field   1:  `COALESCE(a,b)`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       VAR_STRING
Collation:  utf8_general_ci (33)
Length:     57
Max_length: 0
Decimals:   39
Flags:      UNSIGNED

Note, in prints the UNSIGNED flag, although this flag is not applicable to VAR_STRING.

Note, this script correctly creates a column of the VARCHAR data type without any UNSIGNED flags:

CREATE OR REPLACE TABLE t1 (a INT UNSIGNED, b TIMESTAMP);
CREATE OR REPLACE TABLE t2 AS SELECT COALESCE(a,b) AS c FROM t1;
SHOW CREATE TABLE t2;

+-------+--------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                 |
+-------+--------------------------------------------------------------------------------------------------------------+
| t2    | CREATE TABLE `t2` (
  `c` varchar(19) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+--------------------------------------------------------------------------------------------------------------+

Result field metadata should be fixed to match the column type created in CREATE..SELECT.


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