> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cockroachlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Technical Advisory 76522

export const InternalLink = ({version, path = "", children, ...props}) => {
  let detectedVersion = version || "stable";
  if (typeof window !== 'undefined' && !version) {
    const match = window.location.pathname.match(/\/docs\/([^/]+)/);
    if (match) {
      detectedVersion = match[1];
    }
  }
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
  return <a href={`/docs/${detectedVersion}/${normalizedPath}`} {...props}>
      {children}
    </a>;
};

Publication date: March 9, 2022

## Description

The [optimizer](https://www.cockroachlabs.com/docs/v21.2/cost-based-optimizer) can omit `ON` conditions of [joins](https://www.cockroachlabs.com/docs/v21.2/joins) in query plans, causing incorrect results. The bug has only been observed when queries contained 4 or more joins, but it is possible that queries with fewer joins could be affected.

The bug is present in CockroachDB v20.2, v21.1, and v21.2.

This issue is fixed in <InternalLink version="releases" path="v21.1">v21.1.16</InternalLink> and v21.2.7.

## Statement

The fix has been applied to maintenance versions <InternalLink version="releases" path="v21.1">v21.1.16</InternalLink> and v21.2.7 of CockroachDB.

## Mitigation

Users of CockroachDB are encouraged to upgrade to a maintenance version with the fix applied.

## Impact

All deployments up to v20.2.19, v21.1.15, and v21.2.6 are affected.

Queries with joins could return incorrect results in rare cases. The bug has only been observed when queries contained 4 or more joins, but it is possible that queries with fewer joins could be affected.

Questions about any technical alert can be directed to our [support team](https://support.cockroachlabs.com/).
