Debian Codegraph @

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

raw
1 -- source include/not_embedded.inc
2 # Tests for sys schema
3 # Verify the sys.ps_thread_id() function perfoms as expected
4
5 # Passing unknown connection id should return NULL
6 SELECT sys.ps_thread_id(234623462376);
7
8 # Grab the thread_id for this connection directly from Performance Schema
9 let $MY_THREAD_ID=`SELECT thread_id FROM performance_schema.threads
10 WHERE PROCESSLIST_ID = connection_id()`;
11
12 --disable_query_log ONCE
13 eval SET @ps_thread_id = $MY_THREAD_ID;
14
15 SELECT sys.ps_thread_id(CONNECTION_ID()) = @ps_thread_id;
16
17 # Passing NULL should also return the current connection thread id
18 SELECT sys.ps_thread_id(NULL) = @ps_thread_id;