Menu

#760 Export no rows when query uses set variable

4.7.7
open-accepted
nobody
None
5
2021-02-06
2020-08-05
No

I've been experiencing this issue a lot lately and just realized that the issue was not with the data I was pulling/exporting but because the query was returning no rows when the export was happening.

I'm setting 2 variables like this in the SQL Command window :
set @from := '2020-07-01';
set @to := '2020-07-31';

and then it's followed by a simple query like this
SELECT id
FROM table1
WHERE date >= date(@from) AND date <= date(@to)

Adminer does display the result as expected, but when exporting the result to a CSV I only get the BOM.

If instead of using variable, the values are specified in the query, then the export works.

Before finding the variable was the issue I played with the character set and collate thinking they could cause the issue but it changed nothing.

Currently the DB and most tables are set to UTF8, engine is InnoDB

1 Attachments

Discussion

  • Jakub Vrána

    Jakub Vrána - 2021-02-06
    • status: open --> open-accepted
     
  • Jakub Vrána

    Jakub Vrána - 2021-02-06

    Adminer re-runs the query when exporting. But it re-runs only the single query, not the previous queries which may set the state. I don't know how to fix this.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.