Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit 98ca1b8

Browse files
committed
Add input variable boundary tests for a number of routines
1 parent e945542 commit 98ca1b8

File tree

6 files changed

+36
-1
lines changed

6 files changed

+36
-1
lines changed

mysql-test/suite/sysschema/r/fn_ps_thread_account.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ NULL
44
SELECT sys.ps_thread_account(234623462376);
55
sys.ps_thread_account(234623462376)
66
NULL
7+
SELECT sys.ps_thread_account(-1);
8+
ERROR 22003: Out of range value for column 'in_thread_id' at row 1
79
SELECT sys.ps_thread_account(sys.ps_thread_id(NULL));
810
sys.ps_thread_account(sys.ps_thread_id(NULL))
911
root@localhost

mysql-test/suite/sysschema/r/pr_statement_performance_analyzer.result

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,11 +449,15 @@ CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'analys
449449
ERROR 45000: An existing snapshot generated with the statement_performance_analyzer() must exist.
450450
DROP TEMPORARY TABLE sys.tmp_digests_delta;
451451
ERROR 42S02: Unknown table 'sys.tmp_digests_delta'
452+
SET @identifier := REPEAT('a', 65);
453+
CALL sys.statement_performance_analyzer('snapshot', CONCAT(@identifier, '.', @identifier), NULL);
454+
ERROR 22001: Data too long for column 'in_table' at row 1
452455
DROP TEMPORARY TABLE test.tmp_digests_ini;
453456
DROP TEMPORARY TABLE test.tmp_digests;
454457
DROP TABLE test.tmp_unsupported;
455458
DROP TABLE test.t1;
456459
DROP VIEW view_digests;
460+
SET @identifier := NULL;
457461
SET SESSION sql_mode = @@global.sql_mode;
458462
SET @sys.statement_performance_analyzer.limit = NULL;
459463
SET @sys.statement_performance_analyzer.view = NULL;
@@ -465,5 +469,6 @@ INSERT IGNORE INTO sys.sys_config (variable, value) VALUES
465469
('statement_performance_analyzer.limit', 100),
466470
('statement_performance_analyzer.view', NULL),
467471
('diagnostics.allow_i_s_tables', 'OFF'),
468-
('diagnostics.include_raw', 'OFF');
472+
('diagnostics.include_raw', 'OFF'),
473+
('ps_thread_trx_info.max_length', 65535);
469474
SET @sys.ignore_sys_config_triggers := NULL;

mysql-test/suite/sysschema/r/pr_table_exists.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ CALL sys.table_exists('test', 't2', @exists);
1919
SELECT @exists;
2020
@exists
2121

22+
SET @identifier := REPEAT('a', 65);
23+
CALL sys.table_exists(@identifier, 't1', @exists);
24+
ERROR 22001: Data too long for column 'in_db' at row 1
25+
CALL sys.table_exists('test', @identifier, @exists);
26+
ERROR 22001: Data too long for column 'in_table' at row 1
2227
DROP TEMPORARY TABLE t1;
2328
DROP TABLE t1;
2429
DROP VIEW v_t1;
30+
SET @identifier := NULL;

mysql-test/suite/sysschema/t/fn_ps_thread_account.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@
66
SELECT sys.ps_thread_account(NULL);
77
SELECT sys.ps_thread_account(234623462376);
88

9+
-- error 1264
10+
SELECT sys.ps_thread_account(-1);
11+
912
# Check result
1013
SELECT sys.ps_thread_account(sys.ps_thread_id(NULL));

mysql-test/suite/sysschema/t/pr_statement_performance_analyzer.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
##################################################################################
1010

1111
-- source include/not_embedded.inc
12+
# Performance schema tracks prepared statements separately, and does not
13+
# yet have a summary view that we can use for this view.
14+
# Until then, we disable this test with --ps-protocol
15+
-- source include/no_protocol.inc
1216

1317
use test;
1418
--disable_warnings
@@ -248,13 +252,18 @@ CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'analys
248252
-- error ER_BAD_TABLE_ERROR
249253
DROP TEMPORARY TABLE sys.tmp_digests_delta;
250254

255+
# Try and use a table.db name > 129
256+
SET @identifier := REPEAT('a', 65);
257+
-- error 1406
258+
CALL sys.statement_performance_analyzer('snapshot', CONCAT(@identifier, '.', @identifier), NULL);
251259

252260
# Clean up
253261
DROP TEMPORARY TABLE test.tmp_digests_ini;
254262
DROP TEMPORARY TABLE test.tmp_digests;
255263
DROP TABLE test.tmp_unsupported;
256264
DROP TABLE test.t1;
257265
DROP VIEW view_digests;
266+
SET @identifier := NULL;
258267

259268
SET SESSION sql_mode = @@global.sql_mode;
260269
SET @sys.statement_performance_analyzer.limit = NULL;

mysql-test/suite/sysschema/t/pr_table_exists.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,17 @@ SELECT @exists;
2525
CALL sys.table_exists('test', 't2', @exists);
2626
SELECT @exists;
2727

28+
# Try variables longer than expected
29+
SET @identifier := REPEAT('a', 65);
30+
31+
-- error 1406
32+
CALL sys.table_exists(@identifier, 't1', @exists);
33+
34+
-- error 1406
35+
CALL sys.table_exists('test', @identifier, @exists);
36+
2837
# Clean up
2938
DROP TEMPORARY TABLE t1;
3039
DROP TABLE t1;
3140
DROP VIEW v_t1;
41+
SET @identifier := NULL;

0 commit comments

Comments
 (0)