More work adding the database quoting stuff for bug #8365.