Bug #20021 show command with like

Submitted: 23 May 2006 9:22 Modified: 23 May 2006 11:53
Reporter: mike rahm Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0 OS:Windows (win xp)
Assigned to: CPU Architecture:Any

[23 May 2006 9:22] mike rahm
Description:
A problem with wildcards in show command:

mysql> show variables like "%\\\%";
Empty set (0.00 sec)

lists 0

a search with where works - this seems not to be clean ..
mysql> show variables where value like "%\\\%";
+---------------------------+-----------------------------------------------------+
| Variable_name             | Value                                               |
+---------------------------+-----------------------------------------------------+
| basedir                   | C:\Programme\MySQL\MySQL Server 5.0\                |
| character_sets_dir        | C:\Programme\MySQL\MySQL Server 5.0\share\charsets\ |
| datadir                   | C:\Programme\MySQL\MySQL Server 5.0\Data\           |
| innodb_log_group_home_dir | .\                                                  |
| language                  | C:\Programme\MySQL\MySQL Server 5.0\share\english\  |
| log_error                 | .\pco174.err                                        |
| pid_file                  | C:\Programme\MySQL\MySQL Server 5.0\Data\pco174.pid |
| slave_load_tmpdir         | C:\WINDOWS\TEMP\                                    |
+---------------------------+-----------------------------------------------------+

How to repeat:
show variables like "%\\\%";

show variables where value like "%\\\%";

Suggested fix:
like seems to work only on first collumn - should work for all collumns
[23 May 2006 11:10] mike rahm
sorry version is 5.0
[23 May 2006 11:53] Valeriy Kravchuk
Thank you for a problem report. Sorry, but it is not a bug. Please, read the manual (http://dev.mysql.com/doc/refman/5.0/en/show-variables.html):

"With a LIKE clause, the statement displays only those variables that match the pattern. To obtain a specific variable name, use a LIKE clause as shown:

SHOW VARIABLES LIKE 'max_join_size';
SHOW SESSION VARIABLES LIKE 'max_join_size';

To get a list of variables whose name match a pattern, use the ‘%’ wildcard character in a LIKE clause:

SHOW VARIABLES LIKE '%size%';
SHOW GLOBAL VARIABLES LIKE '%size%';"

So, LIKE is applied to varable names, not values.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.