ClickHouse/tests/queries/0_stateless/02933_sqid.sql
2024-01-07 08:07:03 +00:00

30 lines
1.3 KiB
SQL

-- Tags: no-fasttest
SET allow_suspicious_low_cardinality_types = 1;
SELECT '-- negative tests';
SELECT sqidEncode(); -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
SELECT sqidDecode(); -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
SELECT sqidEncode('1'); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
SELECT sqidDecode(1); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
SELECT '-- const UInt*';
SELECT sqidEncode(1) AS sqid, sqidDecode(sqid);
SELECT sqidEncode(1, 2) AS sqid, sqidDecode(sqid);
SELECT sqidEncode(1, 2, 3) AS sqid, sqidDecode(sqid);
SELECT sqidEncode(1::UInt8, 2::UInt16, 3::UInt32, 4::UInt64) AS sqid, sqidDecode(sqid);
SELECT sqidEncode(toNullable(1), toLowCardinality(2)) AS sqid;
SELECT '-- non-const UInt*';
SELECT sqidEncode(materialize(1)) AS sqid, sqidDecode(sqid);
SELECT sqidEncode(materialize(1), materialize(2)) AS sqid, sqidDecode(sqid);
SELECT sqidEncode(materialize(1), materialize(2), materialize(3)) AS sqid, sqidDecode(sqid);
SELECT sqidEncode(materialize(1::UInt8), materialize(2::UInt16), materialize(3::UInt32), materialize(4::UInt64)) AS sqid, sqidDecode(sqid);
SELECT sqidEncode(toNullable(materialize(1)), toLowCardinality(materialize(2)));
SELECT '-- invalid sqid';
SELECT sqidDecode('invalid sqid');
SELECT '-- alias';
SELECT sqid(1, 2);