[MDEV-24230] subquery on information_schema fails with error message Created: 2020-11-17  Updated: 2020-11-25  Resolved: 2020-11-25

Status: Closed
Project: MariaDB Server
Component/s: Data Manipulation - Subquery
Affects Version/s: 10.5.8, 10.3, 10.4, 10.5
Fix Version/s: 10.3.28, 10.4.18, 10.5.9

Type: Bug Priority: Critical
Reporter: Sebastian Weiser Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: regression
Environment:

Ubuntu 20.04.1 LTS / Ubuntu 18.04.5 LTS


Issue Links:
PartOf

 Description   

In 10.5.8, do this:

CREATE OR REPLACE TABLE _test1 (num INT);
CREATE OR REPLACE TABLE _test2 (num INT);
INSERT INTO `_test1` SET `num` = (SELECT `table_rows` FROM `information_schema`.`tables` WHERE `table_name`='_test2');

The last statement returns "SQL Error (1406): Data too long for column 'TABLE_SCHEMA' at row 1".
It did work fine in 10.4.8.
On 10.4.17, the same sequence returns either the same error or "ERROR 1242 (21000): Subquery returns more than 1 row" (which is wrong, the subquery on its own returns exactly one row). Which of these error messages i get seems to depend on the user.

I got the error message about "more than 1 row" on 10.5.8 when trying

INSERT INTO `_test1` SET `num` = (SELECT `version` FROM `information_schema`.`tables` WHERE `table_name`='_test2');

Other similar queries also fail:

INSERT INTO `_test1` SET `num` = (SELECT `maxlen` FROM `information_schema`.`character_sets` WHERE `default_collate_name`='ascii_general_ci');
INSERT INTO `_test1` SET `num` = (SELECT COUNT(*) FROM `information_schema`.`system_variables`);

It seems like this occurs with any non-empty table from information_schema, both Memory and Aria. I never saw that from any other database.



 Comments   
Comment by Alice Sherepa [ 2020-11-17 ]

Thanks a lot for the report!
This regression appeared in 10.3 e64084d5a3a72462fa6 (~MDEV-21201)

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