[MDEV-18357] Nil return on subquery in IS Created: 2019-01-23  Updated: 2019-05-17

Status: Open
Project: MariaDB Server
Component/s: Information Schema
Affects Version/s: 10.2.20
Fix Version/s: 10.2

Type: Bug Priority: Major
Reporter: VAROQUI Stephane Assignee: Alexey Botchkov
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Randomly i get such issue

Could not fetch master tables sql: Scan error on column index 6: converting driver.Value type <nil> ("<nil>") to a uint64:
 
SELECT a.TABLE_SCHEMA as Table_schema ,  a.TABLE_NAME as Table_name ,a.ENGINE as Engine,a.TABLE_ROWS as Table_rows ,COALESCE(a.DATA_LENGTH,0) as Data_length,COALESCE(a.INDEX_LENGTH,0) as Index_length ,(select CONV(LEFT(MD5(group_concat(concat(b.column_name,b.column_type,COALESCE(b.is_nullable,''),COALESCE(b.CHARACTER_SET_NAME,''), COALESCE(b.COLLATION_NAME,''),COALESCE(b.COLUMN_DEFAULT,''),COALESCE(c.CONSTRAINT_NAME,''),COALESCE(c.ORDINAL_POSITION,'')))), 16), 16, 10)    FROM information_schema.COLUMNS b left join information_schema.KEY_COLUMN_USAGE c ON b.table_schema=c.table_schema  and  b.table_name=c.table_name where b.table_schema=a.table_schema  and  b.table_name=a.table_name ) as Table_crc FROM information_schema.TABLES a WHERE a.TABLE_TYPE='BASE TABLE' and a.TABLE_SCHEMA NOT IN('information_schema','mysql','performance_schema')

This is SQL is tracking schema changes an works on many workload but i guess return wrong nil value on rename or create or replace table as the only specific processing is a scheduler job similar to this

set sql_log_bin=0;  
CREATE DATABASE IF NOT EXISTS geonames;
USE geonames;
 
 
CREATE OR REPLACE TABLE `geo_name_new` ( 
`geonameid` int(10) unsigned NOT NULL default '0', 
`name` varchar(200) NOT NULL default '', 
`ansiname` varchar(200) NOT NULL default '', 
`alternatenames` varchar(2000) NOT NULL default '', 
`latitude` double NOT NULL default '0', 
`longitude` double NOT NULL default '0', 
`feature_class` char(1) , 
`feature_code` varchar(10) , 
`country_code` char(2), 
`cc2` varchar(60), 
`admin1_code` varchar(20) default '', 
`admin2_code` varchar(80) default '', 
`admin3_code` varchar(20) default '', 
`admin4_code` varchar(20) default '', 
`population` bigint(11) default '0', 
`elevation` int(11) default '0', 
`gtopo30` int(11) default '0', 
`timezone` varchar(40), 
`modification_date` date default '0000-00-00', 
PRIMARY KEY (`geonameid`) 
) CHARACTER SET utf8 ; 
 
set global local_infile=1; 
load data local infile 'allCountries.txt' INTO TABLE geo_name_new; 
alter table geo_name_new add column gis_point POINT NOT NULL DEFAULT  (POINT(latitude,longitude)), add spatial index geo(gis_point) ;
drop table if exists geo_name_old;
RENAME TABLE geo_filter to geo_name_old , geo_name_new to geo_name; 
  



 Comments   
Comment by Alice Sherepa [ 2019-01-25 ]

Could you please describe the bug more detailed. I write what I understood, please correct me if I'm wrong.
1)"Scan error on column index 6: converting driver.Value type <nil> ("<nil>") to a uint6" -
server returned NULL, but it is not supposed to be NULL, so it fails with the error?
2)on the 6th position - COALESCE(a.INDEX_LENGTH,0) AS Index_length?
If possible, please provide a recipe for reproducing the error.

Comment by VAROQUI Stephane [ 2019-01-26 ]

1) column index 6: is subquery result
2) Means the table and it's meta data are no atomic changed

Comment by VAROQUI Stephane [ 2019-05-17 ]

can it be related MDEV-19490

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