Skip to content

Commit 93aadda

Browse files
author
Vesa Pentti
committed
MDEV-13149 -- show function status now works with PAD_CHAR_TO_FULL_LENGTH
1 parent c2509a1 commit 93aadda

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
create function f() returns int return 1;
2+
show function status;
3+
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
4+
T f T T T T T T T T T
5+
set sql_mode = 'PAD_CHAR_TO_FULL_LENGTH';
6+
show function status;
7+
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
8+
T f T T T T T T T T T
9+
drop function f;
10+
select @@sql_mode;
11+
@@sql_mode
12+
PAD_CHAR_TO_FULL_LENGTH
13+
create function f() returns int return 1;
14+
select ROUTINE_NAME from information_schema.ROUTINES where ROUTINE_NAME='f';
15+
ROUTINE_NAME
16+
f
17+
set sql_mode = 'PAD_CHAR_TO_FULL_LENGTH';
18+
select ROUTINE_NAME from information_schema.ROUTINES where ROUTINE_NAME='f';
19+
ROUTINE_NAME
20+
f
21+
drop function f;
22+
select @@sql_mode;
23+
@@sql_mode
24+
PAD_CHAR_TO_FULL_LENGTH
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# Test that show function status succeeds with
3+
# sql_mode = 'PAD_CHAR_TO_FULL_LENGTH (MDEV-13149)
4+
5+
# show function status
6+
7+
create function f() returns int return 1;
8+
--replace_column 1 T 3 T 4 T 5 T 6 T 7 T 8 T 9 T 10 T 11 T
9+
show function status;
10+
set sql_mode = 'PAD_CHAR_TO_FULL_LENGTH';
11+
--replace_column 1 T 3 T 4 T 5 T 6 T 7 T 8 T 9 T 10 T 11 T
12+
show function status;
13+
drop function f;
14+
select @@sql_mode;
15+
16+
# select ROUTINE_NAME from information_schema.ROUTINES
17+
18+
create function f() returns int return 1;
19+
select ROUTINE_NAME from information_schema.ROUTINES where ROUTINE_NAME='f';
20+
set sql_mode = 'PAD_CHAR_TO_FULL_LENGTH';
21+
select ROUTINE_NAME from information_schema.ROUTINES where ROUTINE_NAME='f';
22+
drop function f;
23+
select @@sql_mode;

sql/sql_show.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5716,6 +5716,10 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond)
57165716
DBUG_RETURN(1);
57175717
}
57185718

5719+
/* Disable padding temporarily so it doesn't break the query */
5720+
ulonglong sql_mode_was = thd->variables.sql_mode;
5721+
thd->variables.sql_mode &= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
5722+
57195723
if (proc_table->file->ha_index_init(0, 1))
57205724
{
57215725
res= 1;
@@ -5751,6 +5755,7 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond)
57515755
(void) proc_table->file->ha_index_end();
57525756

57535757
close_system_tables(thd, &open_tables_state_backup);
5758+
thd->variables.sql_mode = sql_mode_was;
57545759
DBUG_RETURN(res);
57555760
}
57565761

0 commit comments

Comments
 (0)