Bug 104095 - Report wizard's grouping function unable to handle duplicate column names
Summary: Report wizard's grouping function unable to handle duplicate column names
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
5.1.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-21 17:57 UTC by impocta
Modified: 2017-06-28 12:34 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description impocta 2016-11-21 17:57:14 UTC
When I use the wizard to generate a report based on the query below

SELECT "a"."datum", "p"."naam", "b"."naam", "a"."uitleg", "type"."naam", "det"."aantal", "materiaalkosten", "arbeidskosten", "det"."uitleg" FROM "onderhoudsactiviteit_boot" "a" LEFT JOIN "persoon" "p" ON "p"."id" = "a"."persoon_id" LEFT JOIN "boot" "b" ON "b"."id" = "a"."boot_id" LEFT JOIN "onderhoudsdetail_boot" "det" ON "det"."onderhoudsactiviteit_boot_id" = "a"."id" LEFT JOIN "onderdeeltype_boot" "type" ON "type"."id" = "det"."onderdeeltype_boot_id" WHERE "a"."datum" >= '2016-07-01 00:00:00' AND "a"."datum" < '2017-07-01 00:00:00'

it gives the following error message:

The query with the statement 
'SELECT "a"."datum", "p"."naam", "b"."naam", "a"."uitleg", "type"."naam", "det"."aantal", "materiaalkosten", "arbeidskosten", "det"."uitleg" FROM "onderhoudsactiviteit_boot" "a" LEFT JOIN "persoon" "p" ON "p"."id" = "a"."persoon_id" LEFT JOIN "boot" "b" ON "b"."id" = "a"."boot_id" LEFT JOIN "onderhoudsdetail_boot" "det" ON "det"."onderhoudsactiviteit_boot_id" = "a"."id" LEFT JOIN "onderdeeltype_boot" "type" ON "type"."id" = "det"."onderdeeltype_boot_id" WHERE "a"."datum" >= '2016-07-01 00:00:00' AND "a"."datum" < '2017-07-01 00:00:00' ORDER BY "datum", "naam", "naam1"' 
 could not be run. 
 Check your data source.

What happens is, that the wizard adds ORDER BY "groupingcolumn1", "groupingcolumn2", etc. But as I am using columns with the same name but from different tables, the wizard adds decides to add a "1" to the end of the duplicate column name. Then it tries to order the results by a column name that does not exist.


I think that the wizard should not use 'made-up' column names to generate SQL code. Instead it should have used the real addresses of the columns. (In this case "persoon"."naam" and "boot"."naam"
Comment 1 Alex Thurgood 2016-11-22 10:38:20 UTC
Does it work if you use fully qualified table name identification instead of aliases in your query?
Comment 2 Robert Großkopf 2016-11-22 17:32:15 UTC
The wizard takes the code you have given him. Why should he know it will go better with another construction. It tries to work with your code and will sort it, if you wish to have groups. So there must be different names for the columns.

The best you could do is to change the query to a view. There you could see columns with the same name doesn't work in the internal HSQLDB.

Indeed it is wrong for the reportbuilder to create "naam1" and "naam2" instead. Has something to do with bug 62248?
The reportbuilder tries to analyze the SQL-code. To prevent buggy behavior there it is better to create views for the report insted af queries.
Comment 3 QA Administrators 2017-05-31 10:51:38 UTC Comment hidden (obsolete)
Comment 4 QA Administrators 2017-06-28 12:34:51 UTC
Dear Bug Submitter,

Please read this message in its entirety before proceeding.

Your bug report is being closed as INSUFFICIENTDATA due to inactivity and
a lack of information which is needed in order to accurately
reproduce and confirm the problem. We encourage you to retest
your bug against the latest release. If the issue is still
present in the latest stable release, we need the following
information (please ignore any that you've already provided):

a) Provide details of your system including your operating
   system and the latest version of LibreOffice that you have
   confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED
and we will attempt to reproduce the issue. Please do not:

a) respond via email 

b) update the version field in the bug or any of the other details
   on the top section of our bug tracker

Warm Regards,
QA Team

MassPing-NeedInfo-20170628