[SQL] Improve debug logging and toStrings.