Commit 48b1d175 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-11943 I_S.TABLES inconsistencies with tables with unknown storage engine

Make SELECT <columns> FROM I_S.TABLES behave identically independently
from whether <columns> require opening the table in engine or
<columns> can be filled with only opening the frm.

In particular, fill_schema_table_from_frm() should not silently skip
frms with unknown engine, but should fill the I_S.TABLES row
with NULLs just like fill_schema_table_by_open() does.
parent 25c32c89
......@@ -1979,6 +1979,11 @@ GROUP BY TABLE_SCHEMA) AS UNIQUES
ON ( COLUMNS.TABLE_SCHEMA = UNIQUES.TABLE_SCHEMA);
COUNT(*) > 0
1
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
DROP TABLE t1;
SET SESSION optimizer_switch= @save_optimizer_switch;
#
......
......@@ -4,6 +4,27 @@ create table t1 (a int) engine=archive;
insert t1 values (1),(2),(3);
flush tables;
uninstall soname 'ha_archive';
select table_schema, table_name from information_schema.tables where table_name like 't1';
table_schema test
table_name t1
select table_schema, table_name, engine, version from information_schema.tables where table_name like 't1';
table_schema test
table_name t1
engine NULL
version NULL
Warnings:
Level Warning
Code 1286
Message Unknown storage engine 'ARCHIVE'
select table_schema, table_name, engine, row_format from information_schema.tables where table_name like 't1';
table_schema test
table_name t1
engine NULL
row_format NULL
Warnings:
Level Warning
Code 1286
Message Unknown storage engine 'ARCHIVE'
install soname 'ha_archive';
t1.ARZ
t1.frm
......
......@@ -1732,7 +1732,7 @@ SPATIAL_REF_SYS CREATE TEMPORARY TABLE `SPATIAL_REF_SYS` (
) ENGINE=MEMORY DEFAULT CHARSET=utf8
create table t1(g GEOMETRY, pt POINT);
create table t2(g LINESTRING, pl POLYGON);
select * from information_schema.geometry_columns;
select * from information_schema.geometry_columns where f_table_schema='test';
F_TABLE_CATALOG F_TABLE_SCHEMA F_TABLE_NAME F_GEOMETRY_COLUMN G_TABLE_CATALOG G_TABLE_SCHEMA G_TABLE_NAME G_GEOMETRY_COLUMN STORAGE_TYPE GEOMETRY_TYPE COORD_DIMENSION MAX_PPR SRID
def test t1 def test t1 g 1 0 2 0 0
def test t1 def test t1 pt 1 1 2 0 0
......@@ -1741,7 +1741,7 @@ def test t2 def test t2 pl 1 3 2 0 0
drop table t1, t2;
10.1 tests
create table t1(g GEOMETRY(9,4) REF_SYSTEM_ID=101, pt POINT(8,2), pg GEOMETRY REF_SYSTEM_ID=102);
SELECT SRID from information_schema.geometry_columns WHERE G_TABLE_NAME='t1';
SELECT SRID from information_schema.geometry_columns WHERE f_table_schema='test' and G_TABLE_NAME='t1';
SRID
101
0
......
......@@ -757,6 +757,9 @@ from information_schema.statistics join information_schema.columns using(table_n
TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA COLUMN_COMMENT
user Host def mysql 0 mysql PRIMARY 1 A NULL NULL BTREE def mysql NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI
user User def mysql 0 mysql PRIMARY 2 A NULL NULL BTREE def mysql NO char 80 240 NULL NULL utf8 utf8_bin char(80) PRI
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
drop table t1;
drop table t2;
drop table t3;
......
......@@ -540,7 +540,7 @@ a b
drop table t1;
create table t1 as select to_seconds(null) as to_seconds;
select data_type from information_schema.columns
where column_name='to_seconds';
where table_schema='test' and column_name='to_seconds';
data_type
int
drop table t1;
......
......@@ -1203,12 +1203,21 @@ prepare my_stmt from @aux;
execute my_stmt;
COUNT(*)
46
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
execute my_stmt;
COUNT(*)
46
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
execute my_stmt;
COUNT(*)
46
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
deallocate prepare my_stmt;
drop procedure if exists p1|
drop table if exists t1|
......
......@@ -97,6 +97,9 @@ COLUMN_COMMENT varchar(1024) NO
SELECT table_catalog, table_schema, table_name, column_name
FROM information_schema.columns WHERE table_catalog IS NULL OR table_catalog <> 'def';
table_catalog table_schema table_name column_name
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
###############################################################################
# Testcase 3.2.6.2 + 3.2.6.3: INFORMATION_SCHEMA.COLUMNS accessible information
###############################################################################
......
......@@ -117,6 +117,20 @@ def mysql index_stats db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_
def mysql index_stats index_name 3 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references
def mysql index_stats prefix_arity 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned PRI select,insert,update,references
def mysql index_stats table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references
def mysql innodb_index_stats database_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references
def mysql innodb_index_stats index_name 3 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references
def mysql innodb_index_stats last_update 4 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references
def mysql innodb_index_stats sample_size 7 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references
def mysql innodb_index_stats stat_description 8 NULL NO varchar 1024 3072 NULL NULL NULL utf8 utf8_bin varchar(1024) select,insert,update,references
def mysql innodb_index_stats stat_name 5 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references
def mysql innodb_index_stats stat_value 6 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references
def mysql innodb_index_stats table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references
def mysql innodb_table_stats clustered_index_size 5 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references
def mysql innodb_table_stats database_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references
def mysql innodb_table_stats last_update 3 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references
def mysql innodb_table_stats n_rows 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references
def mysql innodb_table_stats sum_of_other_index_sizes 6 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references
def mysql innodb_table_stats table_name 2 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references
def mysql plugin dl 2 NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
def mysql plugin name 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) PRI select,insert,update,references
def mysql proc body 11 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob select,insert,update,references
......@@ -438,6 +452,20 @@ NULL mysql help_topic help_category_id smallint NULL NULL NULL NULL smallint(5)
3.0000 mysql index_stats index_name varchar 64 192 utf8 utf8_bin varchar(64)
NULL mysql index_stats prefix_arity int NULL NULL NULL NULL int(11) unsigned
NULL mysql index_stats avg_frequency decimal NULL NULL NULL NULL decimal(12,4)
3.0000 mysql innodb_index_stats database_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql innodb_index_stats table_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql innodb_index_stats index_name varchar 64 192 utf8 utf8_bin varchar(64)
NULL mysql innodb_index_stats last_update timestamp NULL NULL NULL NULL timestamp
3.0000 mysql innodb_index_stats stat_name varchar 64 192 utf8 utf8_bin varchar(64)
NULL mysql innodb_index_stats stat_value bigint NULL NULL NULL NULL bigint(20) unsigned
NULL mysql innodb_index_stats sample_size bigint NULL NULL NULL NULL bigint(20) unsigned
3.0000 mysql innodb_index_stats stat_description varchar 1024 3072 utf8 utf8_bin varchar(1024)
3.0000 mysql innodb_table_stats database_name varchar 64 192 utf8 utf8_bin varchar(64)
3.0000 mysql innodb_table_stats table_name varchar 64 192 utf8 utf8_bin varchar(64)
NULL mysql innodb_table_stats last_update timestamp NULL NULL NULL NULL timestamp
NULL mysql innodb_table_stats n_rows bigint NULL NULL NULL NULL bigint(20) unsigned
NULL mysql innodb_table_stats clustered_index_size bigint NULL NULL NULL NULL bigint(20) unsigned
NULL mysql innodb_table_stats sum_of_other_index_sizes bigint NULL NULL NULL NULL bigint(20) unsigned
3.0000 mysql plugin name varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 mysql plugin dl varchar 128 384 utf8 utf8_general_ci varchar(128)
3.0000 mysql proc db char 64 192 utf8 utf8_bin char(64)
......
......@@ -251,6 +251,9 @@ def mysql user Update_priv 6 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci e
def mysql user User 2 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI
def mysql user x509_issuer 35 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob
def mysql user x509_subject 36 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
##########################################################################
# Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH
##########################################################################
......@@ -272,6 +275,9 @@ COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
1.0000 text utf8 utf8_bin
1.0000 mediumtext utf8 utf8_general_ci
1.0000 text utf8 utf8_general_ci
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
......@@ -289,6 +295,9 @@ COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
3.0000 enum utf8 utf8_general_ci
3.0000 set utf8 utf8_general_ci
3.0000 varchar utf8 utf8_general_ci
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
......@@ -307,6 +316,9 @@ NULL smallint NULL NULL
NULL time NULL NULL
NULL timestamp NULL NULL
NULL tinyint NULL NULL
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
--> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values
--> are 0, which is intended behavior, and the result of 0 / 0 IS NULL
SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
......@@ -572,3 +584,6 @@ NULL mysql user max_user_connections int NULL NULL NULL NULL int(11)
3.0000 mysql user is_role enum 1 3 utf8 utf8_general_ci enum('N','Y')
3.0000 mysql user default_role char 80 240 utf8 utf8_bin char(80)
NULL mysql user max_statement_time decimal NULL NULL NULL NULL decimal(12,6)
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
......@@ -151,6 +151,9 @@ def mysql time_zone_transition_type mysql PRIMARY
def mysql time_zone_transition_type mysql PRIMARY
def mysql user mysql PRIMARY
def mysql user mysql PRIMARY
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
####################################################################################
# Testcase 3.2.14.2 + 3.2.14.3: INFORMATION_SCHEMA.STATISTICS accessible information
####################################################################################
......
......@@ -13,6 +13,7 @@
#
--source include/not_embedded.inc
--source include/have_innodb.inc
let $my_where = WHERE table_schema = 'mysql';
--source suite/funcs_1/datadict/columns.inc
......@@ -15,6 +15,12 @@ insert t1 values (1),(2),(3);
flush tables;
uninstall soname 'ha_archive';
--vertical_results
select table_schema, table_name from information_schema.tables where table_name like 't1';
select table_schema, table_name, engine, version from information_schema.tables where table_name like 't1';
select table_schema, table_name, engine, row_format from information_schema.tables where table_name like 't1';
--horizontal_results
install soname 'ha_archive';
--list_files $mysqld_datadir/test
drop table t1;
......
......@@ -1460,12 +1460,12 @@ SHOW CREATE TABLE information_schema.spatial_ref_sys;
create table t1(g GEOMETRY, pt POINT);
create table t2(g LINESTRING, pl POLYGON);
select * from information_schema.geometry_columns;
select * from information_schema.geometry_columns where f_table_schema='test';
drop table t1, t2;
--echo 10.1 tests
create table t1(g GEOMETRY(9,4) REF_SYSTEM_ID=101, pt POINT(8,2), pg GEOMETRY REF_SYSTEM_ID=102);
SELECT SRID from information_schema.geometry_columns WHERE G_TABLE_NAME='t1';
SELECT SRID from information_schema.geometry_columns WHERE f_table_schema='test' and G_TABLE_NAME='t1';
drop table t1;
-- echo # Expect an int(1) column to be created
......
......@@ -398,7 +398,7 @@ drop table t1;
create table t1 as select to_seconds(null) as to_seconds;
select data_type from information_schema.columns
where column_name='to_seconds';
where table_schema='test' and column_name='to_seconds';
drop table t1;
--error ER_PARSE_ERROR
......
......@@ -4518,7 +4518,17 @@ static int fill_schema_table_from_frm(THD *thd, TABLE *table,
share= tdc_acquire_share_shortlived(thd, &table_list, GTS_TABLE | GTS_VIEW);
if (!share)
{
res= 0;
if (thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE ||
thd->get_stmt_da()->sql_errno() == ER_WRONG_OBJECT)
{
res= 0;
}
else
{
table_list.table= &tbl;
res= schema_table->process_table(thd, &table_list, table,
true, db_name, table_name);
}
goto end;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment