| Summary: | Queries with lookup field and table alias do not work | ||
|---|---|---|---|
| Product: | [Applications] KEXI | Reporter: | Jarosław Staniek <staniek> |
| Component: | Queries | Assignee: | Jarosław Staniek <staniek> |
| Status: | CLOSED FIXED | ||
| Severity: | normal | CC: | andriusmao |
| Priority: | NOR | ||
| Version First Reported In: | 2.8 beta2 | ||
| Target Milestone: | 2.8 | ||
| Platform: | Compiled Sources | ||
| OS: | All | ||
| See Also: | https://bugs.kde.org/show_bug.cgi?id=330410 | ||
| Latest Commit: | http://commits.kde.org/calligra/439504a6502d0340a274bb23e0a6e5cfcc466af2 | Version Fixed/Implemented In: | 2.8.0 |
| Sentry Crash Report: | |||
| Bug Depends on: | |||
| Bug Blocks: | 330410 | ||
| Attachments: | Test case. Contains tables t1, t2, and query q. | ||
Created attachment 85043 [details]
Test case. Contains tables t1, t2, and query q.
Git commit 40364666a4f2253e190a0c143eb5ab2bb0f19d85 by Jaroslaw Staniek. Committed on 08/02/2014 at 20:33. Pushed by staniek into branch 'master'. Make queries with lookup field and table alias work M +2 -2 libs/db/connection.cpp http://commits.kde.org/calligra/40364666a4f2253e190a0c143eb5ab2bb0f19d85 Git commit 439504a6502d0340a274bb23e0a6e5cfcc466af2 by Jaroslaw Staniek. Committed on 08/02/2014 at 20:33. Pushed by staniek into branch 'calligra/2.8'. Make queries with lookup field and table alias work REVIEW:115594 M +2 -2 libs/db/connection.cpp http://commits.kde.org/calligra/439504a6502d0340a274bb23e0a6e5cfcc466af2 |
Queries with lookup field and table alias do not work. Consider database consisted of two tables: t1 (id_t1) t2 (id_t2, id_t1 [lookup-to] t1.id_t1) Then create this query in SQL view: SELECT tb2.id_t1 AS a FROM t2 AS tb2 Kexi executes this physical query: SELECT tb2.id_t1 AS a, __kexidb_t1_0.id_t1, t2.OID FROM t2 AS tb2 LEFT OUTER JOIN t1 AS __kexidb_t1_0 ON t2.id_t1=__kexidb_t1_0.id_t1 Result: Message from server: "no such column: t2.OID" Also "t2.id_t1" in the JOIN isn't correct. Expected: The query should work, physical SQL should look like: SELECT tb2.id_t1 AS a, __kexidb_t1_0.id_t1, t2b.OID FROM t2 AS tb2 LEFT OUTER JOIN t1 AS __kexidb_t1_0 ON t2b.id_t1=__kexidb_t1_0.id_t1 Tested with SQLite but probably applies to any db engine. +++ This bug is related to Bug #330410 +++