Fix bug #3892 SQL Export files are empty
Merge branch 'MAINT_4_0_0' into QA_4_0