Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 394207 - [DB] MySQL does not accept quotes for table aliases
Summary: [DB] MySQL does not accept quotes for table aliases
Status: CLOSED DUPLICATE of bug 351068
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.db (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-13 12:06 EST by Vincenzo Caselli CLA
Modified: 2012-11-16 03:57 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vincenzo Caselli CLA 2012-11-13 12:06:28 EST
We tested 4.2 stream against MySQL and found the following problem:
MySQL does not accept double quotes for table aliases, but they are used here

org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.AbstractHorizontalMappingStrategy.getMinLocalID(Connection)

  final String prefix = "SELECT MIN(\"t\"." + CDODBSchema.ATTRIBUTES_ID + ") FROM " + CDODBSchema.CDO_OBJECTS
        + " \"o\", ";

    final String suffix = " \"t\" WHERE \"t\"." + CDODBSchema.ATTRIBUTES_BRANCH + "<0 AND \"t\"."
        + CDODBSchema.ATTRIBUTES_ID + "=\"o\"." + CDODBSchema.ATTRIBUTES_ID + " AND \"t\"."
        + CDODBSchema.ATTRIBUTES_CREATED + "=\"o\"." + CDODBSchema.ATTRIBUTES_CREATED;
 
double quotes were introduced with commit dba1cf4ec4f47020d1354297b57ba2617729790c along with removing 'AS' keyword.

In our tests a valid cross-database (at least for MySQL, Postgres and Oracle) syntax is this:
- no quotes for table aliases
- no AS keyword

like in:
"select e.* from employees e"
Comment 1 Eike Stepper CLA 2012-11-16 03:57:37 EST
I've removed them altogether via bug 351068, which had recently added them.

*** This bug has been marked as a duplicate of bug 351068 ***