These settings are available in system.settings and are autogenerated from source.
cast_ipv4_ipv6_default_on_conversion_error
Type
Bool
Default
0
Version history
| Version | Default value | Comment |
|---|---|---|
| 22.3 | 0 | Make functions cast(value, 'IPv4') and cast(value, 'IPv6') behave same as toIPv4 and toIPv6 functions |
CAST operator into IPv4, CAST operator into IPV6 type, toIPv4, toIPv6 functions will return default value instead of throwing exception on conversion error.
cast_keep_nullable
Type
Bool
Default
0
Enables or disables keeping of the Nullable data type in CAST operations.
When the setting is enabled and the argument of CAST function is Nullable, the result is also transformed to Nullable type. When the setting is disabled, the result always has the destination type exactly.
Possible values:
- 0 — The
CASTresult has exactly the destination type specified. - 1 — If the argument type is
Nullable, theCASTresult is transformed toNullable(DestinationDataType).
Examples
The following query results in the destination data type exactly:
SET cast_keep_nullable = 0;
SELECT CAST(toNullable(toInt32(0)) AS Int32) as x, toTypeName(x);Result:
┌─x─┬─toTypeName(CAST(toNullable(toInt32(0)), 'Int32'))─┐
│ 0 │ Int32 │
└───┴───────────────────────────────────────────────────┘The following query results in the Nullable modification on the destination data type:
SET cast_keep_nullable = 1;
SELECT CAST(toNullable(toInt32(0)) AS Int32) as x, toTypeName(x);Result:
┌─x─┬─toTypeName(CAST(toNullable(toInt32(0)), 'Int32'))─┐
│ 0 │ Nullable(Int32) │
└───┴───────────────────────────────────────────────────┘See Also
- CAST functio