Bug 145723 - Query in SQL view says there's an error in SQL syntax, but really, it's just an empty result set
Summary: Query in SQL view says there's an error in SQL syntax, but really, it's just ...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.0.6.2 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-16 16:40 UTC by Aaron Gerber
Modified: 2021-11-17 18:31 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 Aaron Gerber 2021-11-16 16:40:50 UTC
Description:
When a query is set up with calculations on a timestamp field, and the result set should be empty, Base complains of an SQL syntax error at the calculation.

This errant error message is debilitatingly confusing, especially since there's no good way to do such calculations in Design View (which would a very nice improvement to base).

Steps to Reproduce:
1.Set up an .odb file with a mySQL backend
2.Set up a query that uses calculations on a timestamp field (such as DATE_ADD()).
3.Arrange for it to produce an empty result set based on a Where clause on a boolean.
4.From the Edit SQL window for the query, click the "Run Query" button.
5.Observe the error message
6.Remove the Where clause that makes the result set empty.
7.Re-click the run button.
8.Observe the lack of error message.


Actual Results:
Confusing errant error message comes up when it shouldn't.

Expected Results:
Empty result set should be shown without error message.


Reproducible: Always


User Profile Reset: No



Additional Info:
In my case, the query SQL spans joined tables.
Comment 1 Robert Großkopf 2021-11-17 14:54:55 UTC
OK, I have a MySQL database and a table with timestamp field. What have I to do now?

SQL-code will be helpfull, also a hint, what has been expected and what really happens and should be a bug.
Comment 2 Aaron Gerber 2021-11-17 15:23:22 UTC
Apologies.

I made an awful mistake.  I'm not sure how it happened, but I had somehow changed my SQL query such that it really did have an error in the syntax one time, but not the other.  This bug report needs to be deleted.  Can I do that as the initiator?
Comment 3 Robert Großkopf 2021-11-17 18:28:32 UTC
(In reply to Aaron Gerber from comment #2)
> Apologies.
> 
> I made an awful mistake.  I'm not sure how it happened, but I had somehow
> changed my SQL query such that it really did have an error in the syntax one
> time, but not the other.  This bug report needs to be deleted.  Can I do
> that as the initiator?

I will this one set to WORKSFROME.
Comment 4 Aaron Gerber 2021-11-17 18:31:36 UTC
Thanks!