Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322810 - OQL statement with AS column name with spaces
Summary: OQL statement with AS column name with spaces
Status: RESOLVED FIXED
Alias: None
Product: MAT
Classification: Tools
Component: Core (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-16 11:55 EDT by Andrew Johnson CLA
Modified: 2010-08-16 11:59 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.