[MDEV-12856] Wrong result set metadata for DIV Created: 2017-05-21  Updated: 2017-05-21  Resolved: 2017-05-21

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.1, 10.2, 10.3
Fix Version/s: 10.3.1

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

Issue Links:
Blocks
blocks MDEV-4912 Data type plugin API version 1 Closed
Relates
relates to MDEV-12854 Synchronize CREATE..SELECT data type ... Closed
relates to MDEV-12857 Out-of-range errors on CREATE..SELECT... Closed

 Description   

SELECT 2 DIV 1;

Field   1:  `2 DIV 1`
Type:       LONGLONG
Collation:  binary (63)
Length:     1
Max_length: 1
Decimals:   0
Flags:      BINARY NUM

CREATE OR REPLACE TABLE t1 AS SELECT 2 DIV 1 AS c;
DESCRIBE t1;

+-------+--------+------+-----+---------+-------+
| Field | Type   | Null | Key | Default | Extra |
+-------+--------+------+-----+---------+-------+
| c     | int(1) | YES  |     | NULL    |       |
+-------+--------+------+-----+---------+-------+

Notice, result set metadata for SELECT 2 DIV 1 reports the data type as LONGLONG. This looks wrong.
A CREATE..SELECT query for the same expression correctly makes an INT column.
Result set metadata should be fixed to report LONG for all DIV expressions creating an INT column. LONGLONG should be reported only for DIV making a BIGINT column in CREATE..SELECT.



 Comments   
Comment by Alexander Barkov [ 2017-05-21 ]

Pushed into bb-10.2-ext

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