Debian Codegraph @

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

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