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

Bug 394207

Summary: [DB] MySQL does not accept quotes for table aliases
Product: [Modeling] EMF Reporter: Vincenzo Caselli <vincenzo.caselli>
Component: cdo.dbAssignee: Project Inbox <emf.cdo-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: stepper, vincenzo.caselli
Version: 4.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

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 ***