Bug #25788 Query Browser does not like indented queries
Submitted: 23 Jan 2007 15:30 Modified: 29 Jan 2007 18:05
Reporter: Adam Wood Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Query Browser Severity:S3 (Non-critical)
Version:1.1.20 OS:Windows (WinXP Pro SP2)
Assigned to: CPU Architecture:Any

[23 Jan 2007 15:30] Adam Wood
Description:
When pasting a query into Query Browser, it will not execute if the last line is indented. For example, the following query (as pasted into the query textbox):

"SELECT tbl.id FROM `some_table` AS tbl
	GROUP BY tbl.id"

Results in the query being rejected with the following error:

"Unknown column 'tbl' in 'group statement' (#1054)"

Although "tbl" is clearly the table alias as opposed to a column.

The query will execute perfectly if indentation is removed from the last line, or an extra line is inserted after the last line. Appending a semicolon to the end of the query, or adjusting indentation of other lines makes no difference. You can even add the indentation back into the last line and it will still execute perfectly; it is only problematic if the indentation is originally included in the paste, it would appear. Indentation of intervening lines (for example JOIN or WHERE clauses that may be between the first and last line) also appears to make no difference.

How to repeat:
*Paste* a query of similar format to the above (it need not be a GROUP BY clause on the last line - JOIN, WHERE etc all appear to have the same problem) into MySQL Query Browser.

The query will fail with the above error, although if the indentation of the last line is removed (and even subsequently restored by typing back in) the query should execute as desired.

Suggested fix:
This would appear to be an issue with how Query Browser is interpreting the {TAB} characters at the start of the line. The seemingly arbitrary nature of the error and the fact that Query Browser then mistakes table aliases for column names would imply also that this is a parsing issue.
[23 Jan 2007 15:39] Adam Wood
OS is WinXP Pro SP2
[23 Jan 2007 17:50] MySQL Verification Team
Thank you for the bug report. I was unable to repeat with latest released
version 1.2.9.
[29 Jan 2007 18:05] Adam Wood
Have installed Query Browser v1.2.9 (RC) and problem appears to be resolved.