                 sqlQueries.removeAll()
                 _ = try Row.fetchAll(db, request)
                 
-                let selectQueries = sqlQueries.filter { $0.contains("SELECT") && !$0.contains("sqlite_") && !$0.contains("pragma_table_xinfo") }
+                let selectQueries = sqlQueries.filter(isSelectQuery)
                 // LEFT JOIN in the first query are useless but harmless.
                 // And SQLite may well optimize them out.
                 // So don't bother removing them.

                sqlQueries.removeAll()
                _ = try Row.fetchAll(db, request)
                
                let selectQueries = sqlQueries.filter { $0.contains("SELECT") && !$0.contains("sqlite_") && !$0.contains("pragma_table_xinfo") }
                XCTAssertEqual(selectQueries, [
                    """
                    SELECT "d".*, "c".*, "a".* \

                sqlQueries.removeAll()
                _ = try Row.fetchAll(db, request)
                
                let selectQueries = sqlQueries.filter(isSelectQuery)
                XCTAssertEqual(selectQueries, [
                    """
                    SELECT * FROM "b" ORDER BY "colb1"
