.. _version_5.1.2:

=============
Version 5.1.2
=============

Released on 2022-12-07.

.. NOTE::

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

    We recommend that you upgrade to the latest 5.0 release before moving to
    5.1.2.

    A rolling upgrade from 5.0.x to 5.1.2 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.1.0` release notes for a full list of changes in the
5.1 series.

Fixes
=====

- Fixed privileges for :ref:`DECLARE <sql-declare>` for cursors to make it
  accessible for non-super-users. All users can declare cursors as long as they
  have the required permissions for the query used within ``DECLARE``.

- Added dynamic bulk sizing for update by query or delete by query operations to
  reduce memory pressure and fix out of memory errors when running update
  statements with large assignment expressions.

- Fixed inefficient join optimizations on hash and nested-loop joins when
  table statistics aren't available.

- Fixed a race condition that could lead to a ``NullPointerException`` when
  using ``IS NULL`` on an object that was just added to a table.

- Fixed an issue that caused the generated expressions on columns of type
  ``GEO_SHAPE`` not being evaluated on writes and such being ignored.

- Fixed an issue that could generate duplicate data on ``COPY FROM``  while
  some internal retries were happening due to I/O errors e.g. socket timeouts.

- Fixed an issue that caused ``routing.allocation.*.{attribute}``
  settings to be ignored when executing ``ALTER TABLE SET`` on a partitioned
  table.

- Fixed an issue that caused the setting, ``number_of_replicas`` to be ignored
  when executing ``ALTER TABLE SET`` on a partitioned table.
