Apache OpenOffice (AOO) Bugzilla – Issue 108079
query designer generates invalid SQL when multiple non-standard joins are used
Last modified: 2017-05-20 10:24:19 UTC
- open the attached database document - open the contained query in the graphical query designer ("Edit" from its context menu) - change the type of both joins from "Inner" to "Left" - execute the query by pressing F4 => you get an error saying something like "Unexpected token ..." If you examine the SQL statement, you find it to be something like the following (shortened): SELECT ... FROM "more events" LEFT OUTER JOIN "events" LEFT OUTER JOIN "time stamps" ON "events"."when" = "time stamps"."when" ON "more events"."when" = "time stamps"."when" , which of course is invalid SQL, the proper version would be something like SELECT ... FROM "time stamps" LEFT OUTER JOIN "events" ON "events"."when" = "time stamps"."when" LEFT OUTER JOIN "more events" ON "more events"."when" = "time stamps"."when"
Created attachment 66989 [details] document to reproduce the bug case
targeting
Fixed in cws dba33f You have to take care that the "time stamps" is on the left side of the connection, otherwise you won't get the expected result.
The problem is the order in which you drop fields from table to another. When looking at the sample you see that when changing to left join the current version of hsqldb doesn't support the functionality to access table fields which are in a nested join. For example Access creates the same SQL statement as we do now. And other databases supports the nested feature as well. E.g. MySQL To make the statement do what you want to you have to delete the joins and create them again. But you have to take care that the "time stamps" table is on the left side. @msc: Please verify. Thanks - Open sample - Edit query and delete joins - Create new joins and take for that "time stamps" is on the left side when you double click the connection - Choose left join => Execute
verified in CWS dba33f find more information about this CWS, like when it is available in the master builds, in EIS, the Environment Information System: http://eis.services.openoffice.org/EIS2/cws.ShowCWS?Path=DEV300%2Fdba33f