bug #4444 No insert statement produced in SQL export for queries with alias

Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
Merge branch 'QA_4_2' into QA_4_3
Merge branch 'QA_4_3'