.. _version_5.2.4:

=============
Version 5.2.4
=============

Released on 2023-03-14.

.. NOTE::

    If you are upgrading a cluster, you must be running CrateDB 4.0.2 or higher
    before you upgrade to 5.2.4.

    We recommend that you upgrade to the latest 5.1 release before moving to
    5.2.4.

    A rolling upgrade from 5.1.x to 5.2.4 is supported.
    Before upgrading, you should `back up your data`_.

.. WARNING::

    Tables that were created before CrateDB 4.x will not function with 5.x
    and must be recreated before moving to 5.x.x.

    You can recreate tables using ``COPY TO`` and ``COPY FROM`` or by
    `inserting the data into a new table`_.

.. _back up your data: https://crate.io/docs/crate/reference/en/latest/admin/snapshots.html
.. _inserting the data into a new table: https://crate.io/docs/crate/reference/en/latest/admin/system-information.html#tables-need-to-be-recreated



.. rubric:: Table of Contents

.. contents::
   :local:

See the :ref:`version_5.2.0` release notes for a full list of changes in the
5.2 series.

Fixes
=====

- Fixed an issue that caused ``JOIN`` queries to fail with an internal error,
  when ``USING`` is used to define the join condition in combination with a
  nested join e.g.::

    SELECT * FROM t1 JOIN (t2 JOIN t3 ON t2.y = t3.y) USING(x)

  Furthermore, validation of ``USING`` was added, so that a meaningful error
  message is thrown in case it's misused.

- Fixed an issue that caused nested joins to fail with an internal error e.g.::

    SELECT * FROM t1 JOIN (t2 JOIN t3 ON t2.x = t3.x) ON t1.x = t2.x

- Fixed an issue that could cause errors for queries with aggregations and
  ``UNION``, e.g. ::

    SELECT a, avg(c), b FROM t1 GROUP BY 1, 3
    UNION
    SELECT x, avg(z), y FROM t2 GROUP BY 1, 3
    UNION
    SELECT i, avg(k), j FROM t3 GROUP BY 1, 3

- Fixed a performance regression for ``IS NOT NULL`` expressions on object
  columns which was introduced in 5.0.3 and 5.1.1.

- Fixed an issue that could cause ``DELETE FROM`` statements which match a large
  amount of records to cause a node to crash with an out of memory error.

- Fixed an issue that caused expressions like ``<column> !=
  ANY(<array-literal>)`` to match on partitions where the column didn't exist or
  on records where ``<column>`` had a ``null`` value.

- Fixed an issue that allowed users to execute
  :ref:`user-defined functions <user-defined-functions>` without ``DQL``
  privileges on the schemas that the functions are defined in.

- Fixed an issue that translated ``ColumnUnknownException`` to a misleading
  ``SchemaUnknownException`` when users without ``DQL`` privilege on ``doc``
  schema queried unknown columns from :ref:`table functions <table-functions>`.
  An example ::

    SELECT unknown_col FROM abs(1);
    SchemaUnknownException[Schema 'doc' unknown]

- Fixed an issue that translated an ``AmbiguousColumnException`` to a
  misleading ``IllegalStateException`` when aliased columns are queried that
  are also ambiguous.
  An example ::

    SELECT r FROM (SELECT a AS r, a AS r FROM t) AS q
    IllegalStateException[Symbol 'io.crate.expression.symbol.Symbol' not supported]
    // r is an alias of a and is ambiguous from the perspective of the outer query

- Fixed an issue that translated ``UnsupportedOperationException`` to a
  misleading ``MissingPrivilegeException`` when executing functions with
  invalid names or signatures.

- Fixed an issue causing nested join statements using the ``NESTED LOOP`` plan
  to return incorrect results in some scenarios when issued on a multi-node
  cluster.
