Apache OpenOffice (AOO) Bugzilla – Issue 97811
Base SQL parser does not accept literal string value using '+' for concatenation
Last modified: 2013-01-29 21:47:38 UTC
Not native executed queries in Base against MS access database that contain a concatenations based on plus symbol, break when a string literal value is involved. The reported error is: SQL Status HY000, Error code:1000 "Syntax error in SQL expression", "syntax error, unexpected $end, expecting BETWEEN or IN or SQL_TOKEN_LIKE" The following example goes wrong: SELECT f1 + 'value' FROM table1; whereas this is OK: SELECT f1 + f2 FROM table1; A workaround is: SELECT X.f1 + X.v FROM ( SELECT f1, 'value' AS "v" FROM table1 ) X
change OS to windows because it is only possible under windows to connect to MS Access tables
I played with the internal database of Base and found the same issue as I reported for Base with MS Access. The internal database supports two concatenation operators '||' and '+'. Base is not able to parse queries that use the '+' operator for concatenation in combination with a literal value. I attached a test database "97811.ods" that contains the following queries: "q_concat_col_plus_col with Base SQL: ok" This query proves that concatenation with '+' symbol is supported with internal database. "q_concat_col_plus_literal with Direct SQL:ok" This query proves that concatenation with '+' symbol is supported with internal database in direct SQL mode. Disable Direct SQL mode makes the query fail. "q_concat_col_plus_literal via derived table with Base SQL: ok" This proves the workaround by using a derived table. Note the other 'workaround' for internal Base database is to use the more common '||' operator, but that is no available for MS access. I assume that both databases suffer from the fact that Base SQL parser can not parse literal string values in combination with '+' symbol as string concatenation.
Created attachment 60939 [details] Test database containing queries for testing
Confirmed w/ OOo 3.1 Updated summary line.