2016-11-24 14:18:44 +00:00
|
|
|
SELECT 1 ? 1 : 0;
|
|
|
|
SELECT 0 ? not_existing_column : 1 FROM system.numbers LIMIT 1;
|
2016-11-29 19:19:15 +00:00
|
|
|
SELECT 1 ? (0 ? not_existing_column : 2) : 0 FROM system.numbers LIMIT 1;
|
2016-11-24 14:18:44 +00:00
|
|
|
|
2016-11-29 19:19:15 +00:00
|
|
|
/* scalar subquery optimization */
|
|
|
|
SELECT (SELECT toUInt8(number + 1) FROM system.numbers LIMIT 1) ? 1 : 2 FROM system.numbers LIMIT 1;
|
2016-11-25 09:29:17 +00:00
|
|
|
|
|
|
|
/* alias test */
|
2016-11-29 19:19:15 +00:00
|
|
|
SELECT (1 as a) ? (2 as b) : (3 as c) as d, a, b, c, d FORMAT TSKV;
|
|
|
|
SELECT (0 as a) ? (2 as b) : (3 as c) as d, a, b, c, d FORMAT TSKV;
|
|
|
|
|
|
|
|
SELECT (1 as a) ? (number + 2 as b) : (number + 3 as c) as d, a, b, c, d FROM system.numbers LIMIT 1 FORMAT TSKV;
|
|
|
|
|
|
|
|
/* intergration test */
|
|
|
|
SELECT (SELECT hasColumnInTable('system', 'numbers', 'not_existing')) ? not_existing : 42 as not_existing FROM system.numbers LIMIT 1 FORMAT TSKV;
|