Exporting query which uses mysql functions such as count() produces incorrect insert statements in SQL export.
Steps to reproduce:
1) Execute some query like this:
select count(*) from `sakila`.`actor`
2) Click 'export' from 'Query results operations' panel.
3) Export with default configurations i.e. (Format: SQL, Export Method: Quick).
This will generate insert into statement in export like this:
INSERT INTO `actor` (`count(*)`) VALUES (200);
which is erroneous because there is no column named 'count(*)'.
What would be your expected SQL in this case? I think it makes little sense to export the results of a count query.
Hi Madhura Jayaratne,
I agree with you, but as export file is generated, it should be error free (executable).
I'm afraid that wouldn't be possible in all cases. For example if you are doing a join between two or more tables, we have no way of creating the table to insert the values. However the user can still use the generated insert queries from the SQL file to insert data to a newly generated table.
Maybe ignoring insert queries in such cases would do the trick?
Also, currently if you try to export (SQL export) a join query between two tables, is causing a fatal error.
When you say ignoring do you mean not including in the generated SQL?
I think exporting the data values is important, so even if the create table statement or column list in insert queries aren't correct, the user can still import the data with some modifications to generated SQL file.
Please open a new bug report for the fatal error.
Exporting selected rows and exporting functionality in Query results operations section is primarily for exporting data rather than structure.
Well, yes I get your point too.
Thanks.