Changed detection of type of SQL query