Fix array index out of bounds issue in Planner

Reviewable, simple fix, waiting for Jenkins Blue.
This will avoid the out of bounds exception, but there's a potential performance issue here: m_sql could be very long, and toUpperCase() is making a copy of it (with upper case letters).  The call to substring was trying to avoid doing this.

Another way to avoid the exception might be:
```Java
if (m_sql.length() > 6 && m_sql.substring(0,6).toUpperCase().startsWith("UPSERT")) {
  ...
}
```