private void checkTableName(Session session, TableName tableName, boolean shouldExist, boolean inIS) {
checkSystemSchema(tableName, inIS);
if (!inIS && (securityService != null) &&
!securityService.isAccessible(session, tableName.getSchemaName())) {
throw new ProtectedTableDDLException(tableName);
}
final boolean tableExists = getAISForChange(session, !inIS).getTable(tableName) != null;
if(shouldExist && !tableExists) {
throw new NoSuchTableException(tableName);
}