mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 02:12:21 +00:00
19 lines
838 B
MySQL
19 lines
838 B
MySQL
|
SET cast_keep_nullable = 0;
|
||
|
|
||
|
SELECT CAST(toNullable(toInt32(0)) AS Int32) as x, toTypeName(x);
|
||
|
SELECT CAST(toNullable(toInt8(0)) AS Int32) as x, toTypeName(x);
|
||
|
|
||
|
SET cast_keep_nullable = 1;
|
||
|
|
||
|
SELECT CAST(toNullable(toInt32(1)) AS Int32) as x, toTypeName(x);
|
||
|
SELECT CAST(toNullable(toInt8(1)) AS Int32) as x, toTypeName(x);
|
||
|
|
||
|
SELECT CAST(toNullable(toFloat32(2)), 'Float32') as x, toTypeName(x);
|
||
|
SELECT CAST(toNullable(toFloat32(2)), 'UInt8') as x, toTypeName(x);
|
||
|
|
||
|
SELECT CAST(if(1 = 1, toNullable(toInt8(3)), NULL) AS Int32) as x, toTypeName(x);
|
||
|
SELECT CAST(if(1 = 0, toNullable(toInt8(3)), NULL) AS Int32) as x, toTypeName(x);
|
||
|
|
||
|
SELECT CAST(a, 'Int32') as x, toTypeName(x) FROM (SELECT materialize(CAST(42, 'Nullable(UInt8)')) AS a);
|
||
|
SELECT CAST(a, 'Int32') as x, toTypeName(x) FROM (SELECT materialize(CAST(NULL, 'Nullable(UInt8)')) AS a);
|