1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

showing table type now is controled by new parameter 'FULL' of SHOW TABLES command (SHOW FULL TABLES) (as it was decided on last dev conf)

This commit is contained in:
bell@sanja.is.com.ua
2004-10-10 13:15:14 +03:00
parent 41ddca4d68
commit 29593da2f6
16 changed files with 137 additions and 126 deletions

View File

@ -1,45 +1,45 @@
show tables; show tables;
Tables_in_mysql table_type Tables_in_mysql
columns_priv BASE TABLE columns_priv
db BASE TABLE db
func BASE TABLE func
help_category BASE TABLE help_category
help_keyword BASE TABLE help_keyword
help_relation BASE TABLE help_relation
help_topic BASE TABLE help_topic
host BASE TABLE host
proc BASE TABLE proc
tables_priv BASE TABLE tables_priv
time_zone BASE TABLE time_zone
time_zone_leap_second BASE TABLE time_zone_leap_second
time_zone_name BASE TABLE time_zone_name
time_zone_transition BASE TABLE time_zone_transition
time_zone_transition_type BASE TABLE time_zone_transition_type
user BASE TABLE user
show tables; show tables;
Tables_in_test table_type Tables_in_test
grant ALL on *.* to test@localhost identified by "gambling"; grant ALL on *.* to test@localhost identified by "gambling";
grant ALL on *.* to test@127.0.0.1 identified by "gambling"; grant ALL on *.* to test@127.0.0.1 identified by "gambling";
show tables; show tables;
Tables_in_mysql table_type Tables_in_mysql
columns_priv BASE TABLE columns_priv
db BASE TABLE db
func BASE TABLE func
help_category BASE TABLE help_category
help_keyword BASE TABLE help_keyword
help_relation BASE TABLE help_relation
help_topic BASE TABLE help_topic
host BASE TABLE host
proc BASE TABLE proc
tables_priv BASE TABLE tables_priv
time_zone BASE TABLE time_zone
time_zone_leap_second BASE TABLE time_zone_leap_second
time_zone_name BASE TABLE time_zone_name
time_zone_transition BASE TABLE time_zone_transition
time_zone_transition_type BASE TABLE time_zone_transition_type
user BASE TABLE user
show tables; show tables;
Tables_in_test table_type Tables_in_test
update mysql.user set password=old_password("gambling2") where user=_binary"test"; update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges; flush privileges;
set password=""; set password="";
@ -47,24 +47,24 @@ set password='gambling3';
ERROR HY000: Password hash should be a 41-digit hexadecimal number ERROR HY000: Password hash should be a 41-digit hexadecimal number
set password=old_password('gambling3'); set password=old_password('gambling3');
show tables; show tables;
Tables_in_mysql table_type Tables_in_mysql
columns_priv BASE TABLE columns_priv
db BASE TABLE db
func BASE TABLE func
help_category BASE TABLE help_category
help_keyword BASE TABLE help_keyword
help_relation BASE TABLE help_relation
help_topic BASE TABLE help_topic
host BASE TABLE host
proc BASE TABLE proc
tables_priv BASE TABLE tables_priv
time_zone BASE TABLE time_zone
time_zone_leap_second BASE TABLE time_zone_leap_second
time_zone_name BASE TABLE time_zone_name
time_zone_transition BASE TABLE time_zone_transition
time_zone_transition_type BASE TABLE time_zone_transition_type
user BASE TABLE user
show tables; show tables;
Tables_in_test table_type Tables_in_test
delete from mysql.user where user=_binary"test"; delete from mysql.user where user=_binary"test";
flush privileges; flush privileges;

View File

@ -45,8 +45,8 @@ CREATE TABLE `
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>" <EFBFBD><EFBFBD><EFBFBD><EFBFBD> CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"
) COMMENT "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; ) COMMENT "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
SHOW TABLES; SHOW TABLES;
Tables_in_test table_type Tables_in_test
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BASE TABLE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SHOW CREATE TABLE <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; SHOW CREATE TABLE <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
Table Create Table Table Create Table
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CREATE TABLE `<60><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>` ( <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CREATE TABLE `<60><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>` (
@ -57,8 +57,8 @@ Field Type Null Key Default Extra
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> char(32) <EFBFBD><EFBFBD><EFBFBD><EFBFBD> char(32)
SET CHARACTER SET cp1251; SET CHARACTER SET cp1251;
SHOW TABLES; SHOW TABLES;
Tables_in_test table_type Tables_in_test
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BASE TABLE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SHOW CREATE TABLE <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; SHOW CREATE TABLE <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
Table Create Table Table Create Table
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CREATE TABLE `<60><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>` ( <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CREATE TABLE `<60><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>` (
@ -69,8 +69,8 @@ Field Type Null Key Default Extra
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> char(32) <EFBFBD><EFBFBD><EFBFBD><EFBFBD> char(32)
SET CHARACTER SET utf8; SET CHARACTER SET utf8;
SHOW TABLES; SHOW TABLES;
Tables_in_test table_type Tables_in_test
таблица BASE TABLE таблица
SHOW CREATE TABLE таблица; SHOW CREATE TABLE таблица;
Table Create Table Table Create Table
таблица CREATE TABLE `таблица` ( таблица CREATE TABLE `таблица` (
@ -93,14 +93,14 @@ SET CHARACTER SET koi8r;
CREATE DATABASE <20><><EFBFBD><EFBFBD>; CREATE DATABASE <20><><EFBFBD><EFBFBD>;
USE <20><><EFBFBD><EFBFBD>; USE <20><><EFBFBD><EFBFBD>;
SHOW TABLES; SHOW TABLES;
Tables_in_<EFBFBD><EFBFBD><EFBFBD><EFBFBD> table_type Tables_in_<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SHOW TABLES IN <20><><EFBFBD><EFBFBD>; SHOW TABLES IN <20><><EFBFBD><EFBFBD>;
Tables_in_<EFBFBD><EFBFBD><EFBFBD><EFBFBD> table_type Tables_in_<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SET CHARACTER SET cp1251; SET CHARACTER SET cp1251;
SHOW TABLES; SHOW TABLES;
Tables_in_<EFBFBD><EFBFBD><EFBFBD><EFBFBD> table_type Tables_in_<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SHOW TABLES IN <20><><EFBFBD><EFBFBD>; SHOW TABLES IN <20><><EFBFBD><EFBFBD>;
Tables_in_<EFBFBD><EFBFBD><EFBFBD><EFBFBD> table_type Tables_in_<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SET CHARACTER SET koi8r; SET CHARACTER SET koi8r;
DROP DATABASE <20><><EFBFBD><EFBFBD>; DROP DATABASE <20><><EFBFBD><EFBFBD>;
SET NAMES koi8r; SET NAMES koi8r;

View File

@ -52,6 +52,6 @@ ERROR HY000: Can't execute the query because you have a conflicting read lock
unlock tables; unlock tables;
create table t1(n int); create table t1(n int);
show tables; show tables;
Tables_in_test table_type Tables_in_test
t1 BASE TABLE t1
drop table t1; drop table t1;

View File

@ -26,9 +26,9 @@ RENAME TABLE T1 TO T2;
ALTER TABLE T2 ADD new_col int not null; ALTER TABLE T2 ADD new_col int not null;
ALTER TABLE T2 RENAME T3; ALTER TABLE T2 RENAME T3;
show tables like 't_'; show tables like 't_';
Tables_in_test (t_) table_type Tables_in_test (t_)
t3 BASE TABLE t3
t4 BASE TABLE t4
drop table t3,t4; drop table t3,t4;
create table t1 (a int); create table t1 (a int);
select count(*) from T1; select count(*) from T1;
@ -79,4 +79,4 @@ select C.a, c.a from t1 c, t2 C;
ERROR 42000: Not unique table/alias: 'C' ERROR 42000: Not unique table/alias: 'C'
drop table t1, t2; drop table t1, t2;
show tables; show tables;
Tables_in_test table_type Tables_in_test

View File

@ -20,10 +20,10 @@ Got one of the listed errors
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t2; rename table t3 to t4, t2 to t3, t1 to t2, t4 to t2;
Got one of the listed errors Got one of the listed errors
show tables like "t_"; show tables like "t_";
Tables_in_test (t_) table_type Tables_in_test (t_)
t1 BASE TABLE t1
t2 BASE TABLE t2
t3 BASE TABLE t3
rename table t3 to t1, t2 to t3, t1 to t2, t4 to t1; rename table t3 to t1, t2 to t3, t1 to t2, t4 to t1;
Got one of the listed errors Got one of the listed errors
rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1; rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1;
@ -45,12 +45,12 @@ CREATE TABLE t3 (a int);
FLUSH TABLES WITH READ LOCK; FLUSH TABLES WITH READ LOCK;
RENAME TABLE t1 TO t2, t3 to t4; RENAME TABLE t1 TO t2, t3 to t4;
show tables; show tables;
Tables_in_test table_type Tables_in_test
t1 BASE TABLE t1
t3 BASE TABLE t3
UNLOCK TABLES; UNLOCK TABLES;
show tables; show tables;
Tables_in_test table_type Tables_in_test
t2 BASE TABLE t2
t4 BASE TABLE t4
drop table t2, t4; drop table t2, t4;

View File

@ -73,25 +73,25 @@ mysqltest3
test test
use mysqltest2; use mysqltest2;
show tables; show tables;
Tables_in_mysqltest2 table_type Tables_in_mysqltest2
t1 BASE TABLE t1
t3 BASE TABLE t3
select * from t1; select * from t1;
n s n s
1 original foo.t1 1 original foo.t1
use mysqltest3; use mysqltest3;
show tables; show tables;
Tables_in_mysqltest3 table_type Tables_in_mysqltest3
t1 BASE TABLE t1
select * from t1; select * from t1;
n s n s
1 original foo2.t1 1 original foo2.t1
use mysqltest; use mysqltest;
show tables; show tables;
Tables_in_mysqltest table_type Tables_in_mysqltest
t1 BASE TABLE t1
t2 BASE TABLE t2
t3 BASE TABLE t3
select * from mysqltest.t1; select * from mysqltest.t1;
n s n s
1 one test 1 one test

View File

@ -11,7 +11,7 @@ show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 273 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 273 # None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 273 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 273 # None 0 No #
show tables like 't1'; show tables like 't1';
Tables_in_test (t1) table_type Tables_in_test (t1)
drop table t1; drop table t1;
select get_lock('crash_lock%20C', 10); select get_lock('crash_lock%20C', 10);
get_lock('crash_lock%20C', 10) get_lock('crash_lock%20C', 10)

View File

@ -2022,15 +2022,15 @@ select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;
Nuvarande period Nuvarande period
9410 9410
show tables; show tables;
Tables_in_test table_type Tables_in_test
t1 BASE TABLE t1
t2 BASE TABLE t2
t3 BASE TABLE t3
t4 BASE TABLE t4
show tables from test like "s%"; show tables from test like "s%";
Tables_in_test (s%) table_type Tables_in_test (s%)
show tables from test like "t?"; show tables from test like "t?";
Tables_in_test (t?) table_type Tables_in_test (t?)
show full columns from t2; show full columns from t2;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
auto int(11) NULL PRI NULL auto_increment select,insert,update,references auto int(11) NULL PRI NULL auto_increment select,insert,update,references

View File

@ -1659,7 +1659,7 @@ Super Server Admin To use KILL thread, SET GLOBAL, CHANGE MASTER, etc.
Update Tables To update existing rows Update Tables To update existing rows
Usage Server Admin No privileges - allow connect only Usage Server Admin No privileges - allow connect only
Variable_name Value Variable_name Value
Tables_in_test (foo) table_type Tables_in_test (foo)
Variable_name Value Variable_name Value
Level Code Message Level Code Message
call bug4902()| call bug4902()|
@ -1709,7 +1709,7 @@ Super Server Admin To use KILL thread, SET GLOBAL, CHANGE MASTER, etc.
Update Tables To update existing rows Update Tables To update existing rows
Usage Server Admin No privileges - allow connect only Usage Server Admin No privileges - allow connect only
Variable_name Value Variable_name Value
Tables_in_test (foo) table_type Tables_in_test (foo)
Variable_name Value Variable_name Value
Level Code Message Level Code Message
drop procedure bug4902| drop procedure bug4902|

View File

@ -1,21 +1,21 @@
show tables; show tables;
Tables_in_db table_type Tables_in_db
columns_priv BASE TABLE columns_priv
db BASE TABLE db
func BASE TABLE func
help_category BASE TABLE help_category
help_keyword BASE TABLE help_keyword
help_relation BASE TABLE help_relation
help_topic BASE TABLE help_topic
host BASE TABLE host
proc BASE TABLE proc
tables_priv BASE TABLE tables_priv
time_zone BASE TABLE time_zone
time_zone_leap_second BASE TABLE time_zone_leap_second
time_zone_name BASE TABLE time_zone_name
time_zone_transition BASE TABLE time_zone_transition
time_zone_transition_type BASE TABLE time_zone_transition_type
user BASE TABLE user
show create table db; show create table db;
Table Create Table Table Create Table
db CREATE TABLE `db` ( db CREATE TABLE `db` (
@ -134,4 +134,4 @@ columns_priv CREATE TABLE `columns_priv` (
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges'
show tables; show tables;
Tables_in_test table_type Tables_in_test

View File

@ -130,6 +130,15 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings: Warnings:
Note 1003 select `v6`.`c` AS `c` from `test`.`v6` Note 1003 select `v6`.`c` AS `c` from `test`.`v6`
show tables; show tables;
Tables_in_test
t1
v1
v2
v3
v4
v5
v6
show full tables;
Tables_in_test table_type Tables_in_test table_type
t1 BASE TABLE t1 BASE TABLE
v1 VIEW v1 VIEW
@ -1043,7 +1052,7 @@ drop table t1;
CREATE VIEW v02 AS SELECT * FROM DUAL; CREATE VIEW v02 AS SELECT * FROM DUAL;
ERROR HY000: No tables used ERROR HY000: No tables used
SHOW TABLES; SHOW TABLES;
Tables_in_test table_type Tables_in_test
CREATE VIEW v1 AS SELECT EXISTS (SELECT 1 UNION SELECT 2); CREATE VIEW v1 AS SELECT EXISTS (SELECT 1 UNION SELECT 2);
select * from v1; select * from v1;
EXISTS (SELECT 1 UNION SELECT 2) EXISTS (SELECT 1 UNION SELECT 2)

View File

@ -82,6 +82,7 @@ explain extended select c from v6;
# show table/table status test # show table/table status test
show tables; show tables;
show full tables;
--replace_column 12 # 13 # --replace_column 12 # 13 #
show table status; show table status;

View File

@ -688,7 +688,8 @@ int mysql_do(THD *thd, List<Item> &values);
/* sql_show.cc */ /* sql_show.cc */
int mysqld_show_dbs(THD *thd,const char *wild); int mysqld_show_dbs(THD *thd,const char *wild);
int mysqld_show_open_tables(THD *thd,const char *wild); int mysqld_show_open_tables(THD *thd,const char *wild);
int mysqld_show_tables(THD *thd,const char *db,const char *wild); int mysqld_show_tables(THD *thd, const char *db, const char *wild,
bool verbose);
int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild); int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild);
int mysqld_show_fields(THD *thd,TABLE_LIST *table, const char *wild, int mysqld_show_fields(THD *thd,TABLE_LIST *table, const char *wild,
bool verbose); bool verbose);

View File

@ -3053,8 +3053,9 @@ unsent_create_error:
res= mysqld_extend_show_tables(thd,db, res= mysqld_extend_show_tables(thd,db,
(lex->wild ? lex->wild->ptr() : NullS)); (lex->wild ? lex->wild->ptr() : NullS));
else else
res= mysqld_show_tables(thd,db, res= mysqld_show_tables(thd, db,
(lex->wild ? lex->wild->ptr() : NullS)); (lex->wild ? lex->wild->ptr() : NullS),
lex->verbose);
break; break;
} }
#endif #endif

View File

@ -137,7 +137,8 @@ int mysqld_show_open_tables(THD *thd,const char *wild)
** A table is a .frm file in the current databasedir ** A table is a .frm file in the current databasedir
***************************************************************************/ ***************************************************************************/
int mysqld_show_tables(THD *thd,const char *db,const char *wild) int mysqld_show_tables(THD *thd, const char *db, const char *wild,
bool show_type)
{ {
Item_string *field=new Item_string("",0,thd->charset()); Item_string *field=new Item_string("",0,thd->charset());
List<Item> field_list; List<Item> field_list;
@ -146,8 +147,6 @@ int mysqld_show_tables(THD *thd,const char *db,const char *wild)
char *file_name; char *file_name;
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
uint len; uint len;
bool show_type = !test(thd->variables.sql_mode &
(MODE_NO_FIELD_OPTIONS | MODE_MYSQL323));
DBUG_ENTER("mysqld_show_tables"); DBUG_ENTER("mysqld_show_tables");
field->name=(char*) thd->alloc(20+(uint) strlen(db)+ field->name=(char*) thd->alloc(20+(uint) strlen(db)+

View File

@ -5844,11 +5844,11 @@ show: SHOW
show_param: show_param:
DATABASES wild DATABASES wild
{ Lex->sql_command= SQLCOM_SHOW_DATABASES; } { Lex->sql_command= SQLCOM_SHOW_DATABASES; }
| TABLES opt_db wild | opt_full TABLES opt_db wild
{ {
LEX *lex= Lex; LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_TABLES; lex->sql_command= SQLCOM_SHOW_TABLES;
lex->select_lex.db= $2; lex->select_lex.db= $3;
} }
| TABLE_SYM STATUS_SYM opt_db wild | TABLE_SYM STATUS_SYM opt_db wild
{ {