Bug 42165 - EDITING: Two left joins do not work in graphic design of a query
Summary: EDITING: Two left joins do not work in graphic design of a query
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
3.3.4 release
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Lionel Elie Mamane
URL:
Whiteboard: target:4.0.0 target:3.6.5
Keywords:
: 57749 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-10-24 07:54 UTC by Robert Großkopf
Modified: 2012-12-03 13:09 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
test with 3.6 (4.70 KB, application/vnd.sun.xml.base)
2012-10-22 20:50 UTC, Julien Nabet
Details
Two queries with two joins - query of GUI didn't work. (4.45 KB, application/vnd.sun.xml.base)
2012-10-23 15:35 UTC, Robert Großkopf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Großkopf 2011-10-24 07:54:26 UTC
Three tables in a query. When changing the join between the tables to "LEFT JOIN" (could also be RIGHT JOIN) the graphic interface makes "FROM table1 LEFT OUTER JOIN table2 LEFT OUTER JOIN table3 ON ..."
Must be: FROM table1 LEFT OUTER JOIN table2 ON ... LEFT OUTER JOIN table3 ON ..."
Comment 1 Julien Nabet 2012-02-25 06:46:37 UTC
Do you reproduce this problem on a brand new document with a newer version (3.5.0 for example) ?
If yes, could you please attach a example file (so it's possible to test more quickly) ?
Have you got warn or error messages in console ?
Comment 2 Robert Großkopf 2012-02-25 08:07:58 UTC
I have tested it with a new database under 3.5.0. Now it works. No problem at all with two joins.
Well done!
Solved in 3.5.0.
Comment 3 Julien Nabet 2012-02-25 08:52:28 UTC
Since you confirm it's ok on 3.5.0, I put it RESOLVED/WORKSFORME (I hesitated with FIXED but we don't know what did fix it).
Comment 4 Robert Großkopf 2012-10-22 19:35:13 UTC
I have to reopen this bug. In a German forum appears the same wrong query with LO 3.5.* - so I tested again with LO 3.5.7.1., 3.5.0 and 3.5.0rc1. The bug is already there. I couldn't explain what I had tested in comment 2.
Comment 5 Julien Nabet 2012-10-22 20:50:49 UTC
Created attachment 68924 [details]
test with 3.6

Robert:
Attached a very basic test file made with 3.6 sources updated yesterday. 
3 tables with some data
2 queries:
- original one
- with right join

What do you think?
Comment 6 Robert Großkopf 2012-10-23 15:35:27 UTC
Created attachment 68956 [details]
Two queries with two joins - query of GUI didn't work.

@comment 5:

The problem appears, when you create a query with two joins, not only one. The GUI creates every time the procedure: first the tables, then the definition of the relations. 
This works for a normal "join" like 
FROM table1, table2, table3 WHERE table1.nameID = table2.ID ...
This doesn't work for right or left joins. There it must look like
FROM table1 LEFT JOIN table2 ON table1.nameID = table2.ID LEFT JOIN table3 ON ...
When a query is created with "JOIN" there must be a definition of the relation directly after the definition of a join.
Comment 7 Lionel Elie Mamane 2012-12-02 17:31:56 UTC
*** Bug 57749 has been marked as a duplicate of this bug. ***
Comment 8 Not Assigned 2012-12-02 17:36:01 UTC
Lionel Elie Mamane committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c25bb400bbfe20b3b13237ed10935ec9d0f6d769

fdo#42165 make nested joins as per strict ANSI SQL



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 9 Lionel Elie Mamane 2012-12-02 17:40:34 UTC
Backport to 3.6.x line pending review; see https://gerrit.libreoffice.org/1225

If all goes well, should be part of 3.6.5. Too late for 3.6.4.
Comment 10 Not Assigned 2012-12-03 12:52:21 UTC
Lionel Elie Mamane committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1cac399e063827349c340cafdec8dc0756f90f1b&g=libreoffice-3-6

fdo#42165 make nested joins as per strict ANSI SQL


It will be available in LibreOffice 3.6.5.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.