Issue 123199 - Query wizard doesn't save search conditions
Summary: Query wizard doesn't save search conditions
Alias: None
Product: Base
Classification: Application
Component: code (show other issues)
Version: 4.0.0
Hardware: All All
: P3 Normal (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Depends on:
Reported: 2013-09-06 02:13 UTC by dpj
Modified: 2015-11-07 19:05 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: 4.2.0-dev
Developer Difficulty: ---

Test base file (10.63 KB, application/vnd.oasis.opendocument.database)
2013-09-06 02:13 UTC, dpj
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description dpj 2013-09-06 02:13:36 UTC
Created attachment 81465 [details]
Test base file

The Base Query Wizard does not apply search conditions.

Steps to reproduce:
1. Download the attached example file.
2. Create a new query with the query wizard.
3. Add the "Size" field to the query, then click 'Next >'.
4. Ignore the sorting order - click 'Next >'.
5. For search conditions, choose the "Table1.Size" field, condition "is equal to" value "3".
6. Then click 'Finish'.

Notice that the results are not filtered. The resulting SQL query that the wizard makes is -- SELECT "Table1"."Size" AS "Size" FROM "Table1" "Table1" --

An alternative set of steps, that results in a different error:
   Follow steps 1-5 above.
6. Click 'Next >' (instead of clicking 'Finish').
7. Click '< Back'.

Notice that the search conditions are all empty. If you enter in a search condition now, and then hit 'Finish', then there is an SQL error:

Syntax error in SQL expression

SELECT "Table1"."Size" AS "Size" FROM "Table1" "Table1" WHERE (Size = 3)

The error seems to come about because the field name in the WHERE is not enclosed by double-quotes.
Comment 1 damjan 2015-11-07 07:11:57 UTC
Confirming with latest SVN on FreeBSD.
Comment 2 damjan 2015-11-07 19:05:43 UTC
There were multiple problems here: size is a reserved word and several columns contain spaces, leading to a failure to filter since quoting is broken when building the query. Those problems were fixed in #126029. Now the remaining problem is that size isn't quoted in the WHERE clause.