Bug #87341 Type of user variable is not exposed in user_variables_by_thread table
Submitted: 7 Aug 19:48 Modified: 8 Aug 7:21
Reporter: Valerii Kravchuk Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S4 (Feature request)
Version:5.7 OS:Any
Assigned to:
Tags: type, user variable, user_variables_by_thread
Triage: Needs Triage: D5 (Feature request)

[7 Aug 19:48] Valerii Kravchuk
Description:
Performance Schema in MySQL 5.7+ kindly provides a useful table to check the values of all user variables defined by user threads, see https://dev.mysql.com/doc/refman/5.7/en/performance-schema-user-variable-tables.html

Unfortunately, user variables are not created equal, they can be of few different types. You can check the source code, but essentially these types are defined in the include/mysql_com.h by the following enum:

enum Item_result {STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT,
                  DECIMAL_RESULT};

So, they can be strings, different kind of numbers and row (whatever it means). Eventually this may become important, as type matters for the precision of further calculations with user variables, for example.

So, it would be nice to add column to show the real current type of a user variable, for each user variable defined. 

How to repeat:
Try to find out from Performance Schema what type does specific user variable have in specific thread. This is relatively easy to do with gdb, for example.

Suggested fix:
Add column to expose data type of user variable in the user_variables_by_thread table.
[8 Aug 7:21] Umesh Shastry
Hello Valeriy,

Thank you for the report and feature request!

Thanks,
Umesh