Bug #97111 MySQL Workbench doesn't know the type of a UDF result
Submitted: 5 Oct 2019 19:44 Modified: 15 Oct 2019 8:09
Reporter: Michiel van Wessem Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:6.3.8, 8.0.18 OS:Linux (Ubuntu 18.04.3 LTS)
Assigned to: CPU Architecture:Any
Tags: WBBugReporter

[5 Oct 2019 19:44] Michiel van Wessem
Description:
Hello,

I'm seeing some strange behavior in MySQL Workbench. I wrote a UDF that takes one string parameter and returns a longlong, or INT in SQL. Let's say it's called it StrLen and I have it in a shared library called strlen.so in the MySQL plugins directory.

CREATE FUNCTION StrLen RETURNS INT SONAME 'strlen.so';

If, using MySQL Workbench, I directly do a SELECT on this function the result is displayed as blob.

(1) SELECT StrLen('hello');

However, the result of the following is shown as the correct number:

(2) SELECT StrLen('hello') * 1;

The result of the following is also display correctly:

(3) SELECT StrLen('hello');``SET @l = Strlen('hello');
    SELECT @l;

I think this is a problem with MySQL Workbench. I tried it with the mysql Linux command line client and this showed the result of (1) correctly. 

I'm seeing it with both the Windows and Linux versions of MySQL Workbench. 

Server version: 
mysql> SHOW VARIABLES LIKE "%version%";
+--------------------------+------------------------------+
| Variable_name            | Value                        |
+--------------------------+------------------------------+
| immediate_server_version | 999999                       |
| innodb_version           | 8.0.17                       |
| original_server_version  | 999999                       |
| protocol_version         | 10                           |
| slave_type_conversions   |                              |
| tls_version              | TLSv1,TLSv1.1,TLSv1.2        |
| version                  | 8.0.17                       |
| version_comment          | MySQL Community Server - GPL |
| version_compile_machine  | x86_64                       |
| version_compile_os       | Linux                        |
| version_compile_zlib     | 1.2.11                       |
+--------------------------+------------------------------+

How to repeat:
- set up a UDF that returns a number, such as
  CREATE FUNCTION StrLen RETURNS INT SONAME 'strlen.so';

- In MySQL Workbench call it with SELECT StrLen('hello');
[15 Oct 2019 8:09] MySQL Verification Team
Hello Michiel,

Thank you for the report.
Verified as described with WB 8.0.18 on Windows 10.

regards,
Umesh