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_uniquescalar 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 theresultsarray represented by a row count for each bulk operation.Numeric literals fitting into the
integerrange are now treated asintegerliterals instead ofbigintliterals. Thus a statement likeselect 1will return anintegercolumn type. This shouldn’t be an issue for most clients as theHTTPendpoint usesJSONfor 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
integerrange, and it can lead to aninteger overflowif the result does not fit into theintegerrange. For example, a calculation like365 * 24 * 60 * 60 * 1000needs to be explicitly cast into thebigintrange 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 readableintervaltype instead:'1 year'::interval.In the PostgreSQL Wire Protocol,
ReadyForQuerymessages now contain theIN TRANSACTIONorFAILED TRANSACTIONindicator based on previousBEGINandCOMMITSQL statements. Before this change, the status always defaulted toIDLE. This change may have the side-effect that an explicitrollbackcall in a client library will result in an unsupportedROLLBACKstatement.
Deprecations¶
The
index.warmer.enabledsetting 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 theCrateDBbuilt. It means thatCrateDBdoesn’t rely onJAVA_HOMEof the host system any longer.Increased the default interval to detect
keystoreortruststorechanges to five minutes.Added a
tablescolumn 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 SUMMARYin the presence of errors to display up to 50line_numbersto 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
nis 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, andtypndefaultfor 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_classandpg_indextable.Added support for record subscript syntax as alternative to the existing object subscript syntax.
Added support for using columns of type
longinside subscript expressions (e.g.,array_expr[column]).Made generate_series addressable by specifying the
pg_catalogschema 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 BYoperations on analysed columns of typetext.
Functions and operators¶
Fixed arithmetics containing a non-floating numeric column type and a floating literal which resulted wrongly in a non-floating return type.
Replaced the
NashornJavaScript engine withGraalVMfor JavaScript user-defined functions. This change upgradesECMAScriptsupport from5.1to10.0.Added the chr scalar function.
Added the array_agg aggregation function.
Added the trunc scalar function.
Added the now scalar function.
Added a
modalias 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
SELECTstatement.Added the cot trigonometric scalar function.
Added the pi scalar function.
Added a
ceilingalias 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
RETURNINGclause for INSERT and UPDATE to return specified values from each row written.
Performance improvements¶
Optimized
<column> IS NOT NULLqueries.