Fixed #3830 Can't export custom query because it lowercases table names