Version 4.2.0
Released on 2020-07-07.
Note
If you are upgrading a cluster, you must be running CrateDB 4.0.2 or higher before you upgrade to 4.2.0.
We recommend that you upgrade to the latest 4.1 release before moving to 4.2.0.
A rolling upgrade from 4.1.7+ to 4.2.0 is supported.
Before upgrading, you should back up your data.
Table of Contents
Breaking Changes
Changed the logic how the
array_unique
scalar function infers the argument types. Previously if the arguments had a different type it used the type of the first argument. For example:cr> select array_unique(['1'], [1.0, 2.0]);
+---------------------------------+
| array_unique(['1'], [1.0, 2.0]) |
+---------------------------------+
| ["1", "1.0", "2.0"] |
+---------------------------------+
This logic has been changed to instead use a type precedence logic to be consistent with how other functions behave:
cr> select array_unique(['1'], [1.0, 2.0]);
+------------+
| [1.0, 2.0] |
+------------+
| [1.0, 2.0] |
+------------+
Bulk
INSERT INTO ... VALUES (...)
statements do not throw an exception any longer when one of the bulk operations fails. The result of the execution is only available via theresults
array represented by a row count for each bulk operation.Numeric literals fitting into the
integer
range are now treated asinteger
literals instead ofbigint
literals. Thus a statement likeselect 1
will return aninteger
column type. This shouldn’t be an issue for most clients as theHTTP
endpoint usesJSON
for serialization and PostgreSQL clients usually use a typedgetLong
.A consequence of this change is that arithmetic with literals used in statements will also happen within the
integer
range, and it can lead to aninteger overflow
if the result does not fit into theinteger
range. For example, a calculation like365 * 24 * 60 * 60 * 1000
needs to be explicitly cast into thebigint
range to avoid aninteger overflow
. This can be done like this:365::bigint * 24 * 60 * 60 * 1000
. If working with timestamps it is recommended to instead use the more readableinterval
type instead:'1 year'::interval
.In the PostgreSQL Wire Protocol,
ReadyForQuery
messages now contain theIN TRANSACTION
orFAILED TRANSACTION
indicator based on previousBEGIN
andCOMMIT
SQL statements. Before this change, the status always defaulted toIDLE
. This change may have the side-effect that an explicitrollback
call in a client library will result in an unsupportedROLLBACK
statement.
Deprecations
- The
index.warmer.enabled
setting has been deprecated and doesn’t have any effect anymore.
Changes
Administration
The JavaScript user-defined function language is now enabled by default in the CrateDB enterprise edition.
Added the optimizer session setting to configure query optimizer rules.
Include the bundled version of
OpenJDK
(14.0.1+7) into theCrateDB
built. It means thatCrateDB
doesn’t rely onJAVA_HOME
of the host system any longer.Increased the default interval to detect
keystore
ortruststore
changes to five minutes.Added a
tables
column to the sys.snapshots table which lists the fully qualified name of all tables contained within the snapshot.Limit the output of
COPY FROM RETURN SUMMARY
in the presence of errors to display up to 50line_numbers
to avoid buffer pressure at clients and to improve readability.
SQL Standard and PostgreSQL compatibility improvements
Added scalar function CURRENT_TIME, that returns the system’s time as microseconds since midnight UTC, at the time the SQL statement is handled. The actual return type is the new data type timetz.
Added new type time with time zone, a.k.a
timetz
, which is to be used as return type for time related functions such as the futurecurrent_time
.Added the oidvector data type which is used in some pg_catalog tables.
Added the Regproc alias data type that is used to reference functions in the pg_catalog tables.
Added the varchar(n) and character varying(n) types, where
n
is an optional length limit.Added the server_version_num and server_version read-only session settings.
Added the pg_catalog.pg_proc table.
Added the pg_catalog.pg_range table.
Added the pg_catalog.pg_enum table.
Added the information_schema.character_sets table.
Added pg_type columns:
typbyval
,typcategory
,typowner
,typisdefined
,typrelid
,typndims
,typcollation
,typinput
,typoutput
, andtypndefault
for improved PostgreSQL compatibility.Added support for
JOIN USING
, e.g.SELECT * FROM t1 JOIN t2 USING (col)
, an alternative toJOIN ON
, when the column name(s) are the same in both relations.Added entries for primary keys to
pg_class
andpg_index
table.Added support for record subscript syntax as alternative to the existing object subscript syntax.
Added support for using columns of type
long
inside subscript expressions (e.g.,array_expr[column]
).Made generate_series addressable by specifying the
pg_catalog
schema explicitly. So, for example, bothgenerate_series(1, 2)
andpg_catalog.generate_series(1, 2)
are valid.Added support for the PostgreSQL notation to refer to array types. For example, it is now possible to use
text[]
instead ofarray(test)
.Added support for
GROUP BY
operations on analysed columns of typetext
.
Functions and operators
Fixed arithmetics containing a non-floating numeric column type and a floatling literal which resulted wrongly in a non-floating return type.
Replaced the
Nashorn
JavaScript engine withGraalVM
for JavaScript user-defined functions. This change upgradesECMAScript
support from5.1
to10.0
.Added the chr scalar function.
Added the array_agg aggregation function.
Added the trunc scalar function.
Added the now scalar function.
Added a
mod
alias for the modulus function for improved PostgreSQL compatibility.Added the atan2 trigonometric scalar function.
Added the exp scalar function.
Added support for using table functions with more than one column within the select list part of a
SELECT
statement.Added the cot trigonometric scalar function.
Added the pi scalar function.
Added a
ceiling
alias for the ceil function for improved PostgreSQL compatibility.Added the encode(bytea, format) and decode(text, format) scalar functions.
Added the ascii scalar function.
Added the obj_description(integer, text) scalar function for improved PostgreSQL compatibility.
Added the format_type(integer, integer) scalar function for improved PostgreSQL compatibility.
Added the version() system information scalar function.
New statements and clauses
Extended the supported syntax for SET TRANSACTION.
Added the DISCARD statement.
Added the CHECK constraint syntax, which specifies that the values of certain columns must satisfy a boolean expression on insert and update.
Introduced new optional
RETURNING
clause for INSERT and UPDATE to return specified values from each row written.
Performance improvements
- Optimized
<column> IS NOT NULL
queries.