Issue 121695

Summary: SQL Queries: Using aliases "t" and "d" leads to syntax error
Product: Base Reporter: Wolfgang Jacques <w.jacques>
Component: codeAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact: Javier Lopez <xavi_dandy>
Severity: Minor    
Priority: P3 CC: fredt, issues, yurggent1.791
Version: 3.4.1Keywords: needhelp
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Latest Confirmation in: 3.4.1
Developer Difficulty: ---

Description Wolfgang Jacques 2013-01-31 13:47:31 UTC
The following statements in the SQL-Query-Window lead to an error:

select d.ID from tbladressen d
select t.Hurz from Tabelle1 t

    Syntax error in SQL expression

    SQL-Status: HY000
    Fehler-Code: 1000

    syntax error, unxpected $end,
    expecting BETWEEN or IN or

The error occurs no matter if I use the internal HSQLDB engine or an external mySQL database attached via Oracle MySQL Connector 1.0.1.

The problem seems to appear with the single letters "d" and "t" only, all other combinations work fine. The problem still appears when using "AS".

With an external database, the problem does not appear when using direct mode.

Issue was discussed here (in German):
Comment 1 Wolfgang Jacques 2013-01-31 13:49:05 UTC
"d" and "t" sounds like "Date" and "Time" - this might add to the solution.
Comment 2 Fred Toussi 2013-02-01 13:30:35 UTC
Confirmed. Also happens when you use ts instead of t.

The workaround is to use any of the following forms:

select d.ID from tbladressen "d"
select t.Hurz from Tabelle1 "t"
select d.ID from tbladressen "D"
select t.Hurz from Tabelle1 "T"
Comment 3 Javier Lopez 2013-02-11 03:08:31 UTC
I was checking your bug and it's true. We'll try to repair soon.

Javier Lopez