show global variables where syntax is broken

Bug #311044 reported by Lee Bieber
4
Affects Status Importance Assigned to Milestone
Drizzle
Fix Released
Medium
Padraig O'Sullivan

Bug Description

Found this in variables.test

drizzle> show global variables like 'warning_count';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| warning_count | 0 |
+---------------+-------+
1 row in set (0.01 sec)

drizzle> show global variables where Variable_name='warning_count';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'where Variable_name='warning_count'' at line 1

I've commented out this test for now, please un-comment once this bug is fixed.

Revision history for this message
Padraig O'Sullivan (posulliv) wrote :

I was able to verify this behavior:

drizzle> show global variables like 'warning_count';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| warning_count | 0 |
+---------------+-------+
1 row in set (0.00 sec)

drizzle> show global variables where Variable_name = 'warning_count';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'where Variable_name = 'warning_count'' at line 1
drizzle>

Thanks, Padraig.

Changed in drizzle:
status: New → Confirmed
Changed in drizzle:
importance: Undecided → Medium
milestone: none → aloha
Revision history for this message
Padraig O'Sullivan (posulliv) wrote :

The fix for this turns out to be pretty simple - we just need to either add a new rule to sql_yacc or modify the existing one that is used for SHOW commands. For example, we can change this:

show_wild:
          /* empty */
        | LIKE TEXT_STRING_sys
          {
            Lex->wild= new (YYSession->mem_root) String($2.str, $2.length,
                                                    system_charset_info);
          }

to this (or we could add a new rule instead of modifying the existing one):

show_wild:
          /* empty */
        | LIKE TEXT_STRING_sys
          {
            Lex->wild= new (YYSession->mem_root) String($2.str, $2.length,
                                                    system_charset_info);
          }
        | WHERE expr
          {
            Select->where= $2;
            if ($2)
              $2->top_level_item();
          }
        ;

and it works fine as shown here:

posulliv@aghadoe:~/repos/drizzle/local-build/tests$ ../client/drizzle --port=9306
Welcome to the Drizzle client.. Commands end with ; or \g.
Your Drizzle connection id is 2
Server version: 2009.06.1055-local-build Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

drizzle> show global variables where variable_name = 'warning_count';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| warning_count | 0 |
+---------------+-------+
1 row in set (0.05 sec)

drizzle>

However, I'm wondering if this is wanted? Was this functionality removed for a reason and do we want to put it back in? I don't know what the original reason for removing this functionality is so I can't comment. If this functionality is wanted, I can push the fix pretty quickly and propose a merge.

Changed in drizzle:
assignee: nobody → Padraig O'Sullivan (posulliv)
status: Confirmed → In Progress
Revision history for this message
Jay Pipes (jaypipes) wrote :

Sure, this looks good. Not sure why this was removed....

Revision history for this message
Padraig O'Sullivan (posulliv) wrote :

Ok, I proposed a branch for merging with this fix in it.

Changed in drizzle:
status: In Progress → Fix Committed
Changed in drizzle:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.