Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 322810

Summary: OQL statement with AS column name with spaces
Product: [Tools] MAT Reporter: Andrew Johnson <andrew_johnson>
Component: CoreAssignee: Project Inbox <mat.core-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P3    
Version: 1.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Andrew Johnson CLA 2010-08-16 11:55:25 EDT
If an OQL statement is typed in with a AS clauses with spaces (using double-quotes) then the statement cannot be reexecuted.

SELECT s.@objectId AS "a b" FROM java.lang.Object s

is printed out as this

SELECT s.@objectId AS a b FROM java.lang.Object s

which fails to execute

Executed Query:
SELECT s.@objectId AS a b FROM java.lang.Object s 

Problem reported:
Encountered "b" at line 1, column 25.
Was expecting one of: 
	"FROM"
Comment 1 Andrew Johnson CLA 2010-08-16 11:59:30 EDT
The fix is simple - it just needs quotes if the column name has spaces (or is of zero length).

I've also written some tests.