Incomplete overhaul of sqlType (less undefined reliance)