docs: private void flushIfDeadlockRisk(Query query, boolean disallowBatching,
        ResultHandler resultHandler,
        BatchResultHandler batchHandler,
        final int flags) throws IOException {
      // Assume all statements need at least this much reply buffer space,
      // plus params
      estimatedReceiveBufferBytes += NODATA_QUERY_RESPONSE_SIZE_BYTES;
  
      SimpleQuery sq = (SimpleQuery) query;
      if (sq.isStatementDescribed()) {
        /*
         * Estimate the response size of the fields and add it to the expected response size.
         *
         * It's impossible for us to estimate the rowcount. We'll assume one row, as that's the common
         * case for batches and we're leaving plenty of breathing room in this approach. It's still
         * not deadlock-proof though; see pgjdbc github issues #194 and #195.
         */
        int maxResultRowSize = sq.getMaxResultRowSize();
        if (maxResultRowSize >= 0) {
          estimatedReceiveBufferBytes += maxResultRowSize;
        } else {
          LOGGER.log(Level.FINEST, "Couldn't estimate result size or result size unbounded, "
              + "disabling batching for this query.");
          disallowBatching = true;
        }
      } else {
        /*
         * We only describe a statement if we're expecting results from it, so it's legal to batch
         * unprepared statements. We'll abort later if we get any uresults from them where none are
         * expected. For now all we can do is hope the user told us the truth and assume that
         * NODATA_QUERY_RESPONSE_SIZE_BYTES is enough to cover it.
         */
      }
  
      if (disallowBatching || estimatedReceiveBufferBytes >= MAX_BUFFERED_RECV_BYTES) {
        LOGGER.log(Level.FINEST, "Forcing Sync, receive buffer full or batching disallowed");
        sendSync();
        processResults(resultHandler, flags);
        estimatedReceiveBufferBytes = 0;
        if (batchHandler != null) {
          batchHandler.secureProgress();
        }
      }
  
    }