Debian Codegraph @

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

raw
1 -- source include/not_embedded.inc
2 # Tests for sys schema
3 # Verify the sys.list_add() function perfoms as expected
4
5 # Should init with a single value
6 SELECT sys.list_add(NULL, 'foo');
7
8 # Should init with a single value
9 SELECT sys.list_add('', 'foo');
10
11 # Should add to the list with a comma
12 SELECT sys.list_add('bar', 'foo');
13
14 # Should add to the list with a single comma
15 SELECT sys.list_add('bar, ', 'foo');
16
17 # Should return an error with a NULL value to add
18 --error 1138
19 SELECT sys.list_add('foo', NULL);
20
21 # Test the sql mode update use case
22 # save old mode to restore
23 SET @sqlmode := @@sql_mode;
24
25 SELECT @@sql_mode;
26
27 SET SESSION sql_mode = sys.list_add(@@sql_mode, 'ANSI_QUOTES');
28
29 SELECT @@sql_mode;
30
31 # restore old mode
32 SET SESSION sql_mode = @sqlmode;
33 SET @sqlmode := NULL;
34
35 # Check too large a value
36 SET @input := REPEAT('a', 4194304);
37 -- error 1406
38 SELECT sys.list_add(@input, 'foo');
39 SET @input := NULL;