.. _version_6.6.0:

==========================
Version 6.6.0 - Unreleased
==========================

.. comment 1. Remove the " - Unreleased" from the header above and adjust the ==
.. comment 2. Remove the NOTE below and replace with: "Released on 20XX-XX-XX."
.. comment    (without a NOTE entry, simply starting from col 1 of the line)
.. NOTE::

    In development. 6.6.0 isn't released yet. These are the release notes for
    the upcoming release.

.. NOTE::

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

    We recommend that you upgrade to the latest 6.5 release before moving to
    6.6.0.

    A rolling upgrade from >= 6.5.0 to 6.6.0 is supported.
    Before upgrading, you should `back up your data`_.

.. WARNING::

    Tables that were created before CrateDB 5.x will not function with 6.x
    and must be recreated before moving to 6.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://cratedb.com/docs/crate/reference/en/latest/admin/snapshots.html
.. _inserting the data into a new table: https://cratedb.com/docs/crate/reference/en/latest/admin/system-information.html#tables-need-to-be-recreated

.. rubric:: Table of contents

.. contents::
   :local:

.. _version_6.6.0_breaking_changes:

Breaking Changes
================


Deprecations
============

None


Changes
=======

SQL Statements
--------------

- Improved :ref:`RENAME COLUMN <sql-alter-table-rename-column>` to preserve
  null-valued object sub-columns when they are renamed. This applies to tables
  created on CrateDB 6.6.0 or later. Tables created on earlier versions retain
  the old name for null-valued sub-columns after a rename.

SQL Standard and PostgreSQL Compatibility
-----------------------------------------

- Added a ``bool`` alias for the :ref:`boolean <type-boolean>` type for improved
  PostgreSQL compatibility.

- Added the ``_name`` array type (OID ``1003``) to the
  :ref:`pg_type <postgres-pg_type>` table, allowing PostgreSQL clients to bind
  ``name[]`` parameters. The ``typarray`` of ``name`` changed from ``-1`` to
  ``1003``.

- Added initial Parquet foreign data wrapper that can read parquet files
  from local storage or from s3 compatible object stores. See :ref:`administration-fdw-parquet`.

Data Types
----------

Scalar and Aggregation Functions
--------------------------------

- Added a :ref:`parquet_metadata <table-functions-parquet_metadata>` table
  function.

- Added a :ref:`parquet_schema <table-functions-parquet_schema>` table
  function.

- Added a :ref:`gen_random_uuid <scalar-gen_random_uuid>` scalar.

- `Manish Singh <https://github.com/manish9363>`_ added the
  :ref:`ends_with(string, suffix) <scalar-ends_with>` scalar function, which
  returns ``true`` if ``string`` ends with ``suffix``.

Performance and Resilience Improvements
---------------------------------------

- Improved the performance for the :ref:`hyperloglog_distinct
  <aggregation-hyperloglog-distinct>` aggregation on text, IP, UUID and
  BitString types for very low cardinalities.

- `Somil Jain <https://github.com/somiljain2006>`_ improved query planning for
  ``LEFT``, ``RIGHT``, and ``FULL OUTER JOIN`` queries with nested join inputs.
  Null-rejecting ``WHERE`` predicates referencing relations within a nested
  input can now be pushed below the outer join. When the predicates reject
  all NULL-extended rows produced by the outer join, it can also be rewritten
  to an ``INNER JOIN``.

- Improved the ``optimizer_eliminate_cross_join`` rule to eliminate more
  cross joins. Previously, some cross joins may have been left when the tables
  form groups that aren't connected with join conditions, like in::

    SELECT *
    FROM t1, t2, t3, t4
    WHERE t2.y = t4.id
      AND t3.z = t4.id

  Previously, the resulting logical plan would contain 1 inner join and 2 cross
  joins. Now, the logical plan has 2 inner joins and 1 cross join.

- Optimized queries with ``DISTINCT``, or with a ``GROUP BY`` without
  aggregates, when the grouping columns include all columns of an explicit
  primary key. In these cases, we can skip unnecessary duplicate elimination
  because the primary key guarantees that each row is unique.

Administration and Operations
-----------------------------

- Added support for renaming :ref:`foreign tables <ref-create-foreign-table>`
  and :ref:`views <ddl-views>` when restoring them with
  :ref:`RESTORE SNAPSHOT <sql-restore-snapshot>`. The
  ``schema_rename_pattern``, ``schema_rename_replacement``,
  ``table_rename_pattern`` and ``table_rename_replacement`` options now also
  apply to foreign tables and views. Previously, they were always restored
  under their original names.

- Changed :ref:`ALTER USER <ref-alter-user>` to require the ``AL`` privilege
  when setting or resetting their own :ref:`JWT properties <auth_jwt>`.

- Improved handling of dropped null-valued object sub-columns when reading
  their parent object.

Client interfaces
-----------------

SQL Standard and PostgreSQL Compatibility
-----------------------------------------
