1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
# name: test/sql/function/generic/error.test
# description: Error test
# group: [generic]
statement error
SELECT error('test')
----
test
statement error
SELECT
CASE
WHEN value = 'foo' THEN 'Value is foo.'
ELSE ERROR(CONCAT('Found unexpected value: ', value))
END AS new_value
FROM (
SELECT 'foo' AS value UNION ALL
SELECT 'baz' AS value);
----
Found unexpected value: baz
query I
SELECT *
FROM (SELECT 4 AS x)
WHERE IF(x % 2 = 0, true, ERROR(FORMAT('x must be even number but is {}', x)));
----
4
statement error
SELECT *
FROM (SELECT 3 AS x)
WHERE IF(x % 2 = 0, true, ERROR(FORMAT('x must be even but is {}', x)));
----
x must be even but is 3
statement error
SELECT 42=error('hello world')
----
hello world
statement error
SELECT error('hello world') IS NULL
----
hello world
|