should be it
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
# name: test/fuzzer/sqlsmith/bitstring_agg_executor.test
|
||||
# description: bitstring_agg overflow
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
CREATE TABLE tbl(v UBIGINT);
|
||||
|
||||
statement ok
|
||||
INSERT INTO tbl VALUES (42);
|
||||
|
||||
statement error
|
||||
SELECT bitstring_agg(v, CAST(v AS UBIGINT), CAST(v AS UBIGINT)) FROM tbl;
|
||||
----
|
||||
bitstring_agg requires a constant min and max argument
|
||||
@@ -0,0 +1,35 @@
|
||||
# name: test/fuzzer/sqlsmith/bitstring_agg_overflow.test
|
||||
# description: bitstring_agg overflow
|
||||
# group: [sqlsmith]
|
||||
|
||||
foreach type utinyint usmallint uinteger ubigint smallint integer bigint hugeint
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE integers(i ${type});
|
||||
|
||||
statement ok
|
||||
INSERT INTO integers VALUES (0), (255);
|
||||
|
||||
statement ok
|
||||
SELECT bitstring_agg(i) FROM integers
|
||||
|
||||
endloop
|
||||
|
||||
statement ok
|
||||
CREATE TABLE all_types AS FROM test_all_types();
|
||||
|
||||
foreach small_type utinyint usmallint
|
||||
|
||||
statement ok
|
||||
SELECT bitstring_agg("${small_type}") FROM all_types;
|
||||
|
||||
endloop
|
||||
|
||||
foreach type tinyint smallint int uint ubigint bigint hugeint
|
||||
|
||||
statement error
|
||||
SELECT bitstring_agg("${type}") FROM all_types;
|
||||
----
|
||||
too large for bitstring aggregation
|
||||
|
||||
endloop
|
||||
@@ -0,0 +1,27 @@
|
||||
# name: test/fuzzer/sqlsmith/current_schemas_null.test
|
||||
# description: current_schemas null input
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE booleans(bool BOOLEAN);
|
||||
|
||||
statement ok
|
||||
INSERT INTO booleans VALUES(NULL);
|
||||
|
||||
query I
|
||||
SELECT current_schemas(false);
|
||||
----
|
||||
[]
|
||||
|
||||
query I
|
||||
SELECT current_schemas(NULL);
|
||||
----
|
||||
NULL
|
||||
|
||||
statement error
|
||||
SELECT current_schemas(ref_0.bool) AS c4 FROM booleans AS ref_0;
|
||||
----
|
||||
<REGEX>:Not implemented Error.*current_schemas requires a constant input.*
|
||||
@@ -0,0 +1,19 @@
|
||||
# name: test/fuzzer/sqlsmith/dayofweek_overflow.test
|
||||
# description: Test overflow in dayofweek
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE dates(date DATE);
|
||||
|
||||
statement ok
|
||||
INSERT INTO dates VALUES('5877642-06-25 (BC)');
|
||||
|
||||
statement ok
|
||||
INSERT INTO dates VALUES('5881580-07-10');
|
||||
|
||||
statement ok
|
||||
SELECT dayofweek(CAST(ref_0.date AS DATE)) AS c9 FROM dates AS ref_0
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# name: test/fuzzer/sqlsmith/fuzzer_window_varchar.test
|
||||
# description: Fuzzer #76: invalid string assertion in window function
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE all_types("varchar" VARCHAR, "double" DOUBLE);;
|
||||
|
||||
statement ok
|
||||
INSERT INTO all_types VALUES('🦆🦆🦆🦆🦆🦆',0);
|
||||
|
||||
statement ok
|
||||
INSERT INTO all_types VALUES('goose',1);
|
||||
|
||||
statement ok
|
||||
SELECT mode(t0."varchar") OVER (PARTITION BY t0."double") AS c18 FROM all_types AS t0;
|
||||
@@ -0,0 +1,38 @@
|
||||
# name: test/fuzzer/sqlsmith/generate_series_overflow.test
|
||||
# description: Fuzzer #26: overflow in generate series
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE tbl(bigint BIGINT);
|
||||
|
||||
statement ok
|
||||
INSERT INTO tbl VALUES(-9223372036854775808);
|
||||
|
||||
statement ok
|
||||
INSERT INTO tbl VALUES(9223372036854775807);
|
||||
|
||||
statement ok
|
||||
INSERT INTO tbl VALUES(NULL);
|
||||
|
||||
statement error
|
||||
SELECT generate_series(CAST(ref_0."bigint" AS BIGINT)) AS c1 FROM tbl AS ref_0
|
||||
----
|
||||
<REGEX>:Invalid Input Error.*Lists larger.*not supported.*
|
||||
|
||||
statement error
|
||||
SELECT generate_series(-9223372036854775808, 9223372036854775807, 1) AS c1
|
||||
----
|
||||
<REGEX>:Invalid Input Error.*Lists larger.*not supported.*
|
||||
|
||||
query I
|
||||
SELECT generate_series(9223372036854775805, 9223372036854775807, 1) AS c1
|
||||
----
|
||||
[9223372036854775805, 9223372036854775806, 9223372036854775807]
|
||||
|
||||
query I
|
||||
SELECT generate_series(-9223372036854775806, -9223372036854775808, -1) AS c1
|
||||
----
|
||||
[-9223372036854775806, -9223372036854775807, -9223372036854775808]
|
||||
@@ -0,0 +1,32 @@
|
||||
# name: test/fuzzer/sqlsmith/interval_diff_overflow.test
|
||||
# description: Overflow in interval part subtraction
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
create table all_types as
|
||||
select * exclude(small_enum, medium_enum, large_enum)
|
||||
from test_all_types();
|
||||
|
||||
statement error
|
||||
SELECT subtract(
|
||||
CAST(main.all_types."interval" AS INTERVAL),
|
||||
CAST(to_months(CAST(main.all_types."int" AS INTEGER)) AS INTERVAL))
|
||||
FROM main.all_types
|
||||
----
|
||||
Out of Range Error: Interval months subtraction out of range
|
||||
|
||||
statement error
|
||||
SELECT subtract(
|
||||
CAST(main.all_types."interval" AS INTERVAL),
|
||||
CAST(to_days(CAST(main.all_types."int" AS INTEGER)) AS INTERVAL))
|
||||
FROM main.all_types
|
||||
----
|
||||
Out of Range Error: Interval days subtraction out of range
|
||||
|
||||
statement error
|
||||
SELECT subtract(
|
||||
CAST(main.all_types."interval" AS INTERVAL),
|
||||
CAST(to_microseconds(CAST(main.all_types."bigint" AS BIGINT)) AS INTERVAL))
|
||||
FROM main.all_types
|
||||
----
|
||||
Out of Range Error: Interval micros subtraction out of range
|
||||
@@ -0,0 +1,14 @@
|
||||
# name: test/fuzzer/sqlsmith/interval_multiply_overflow.test
|
||||
# description: Overflow in interval part multiplication
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
create table all_types as
|
||||
select * exclude(small_enum, medium_enum, large_enum)
|
||||
from test_all_types();
|
||||
|
||||
statement error
|
||||
SELECT multiply("interval", "bigint")
|
||||
FROM all_types;
|
||||
----
|
||||
can't be cast because the value is out of range for the destination type INT32
|
||||
@@ -0,0 +1,23 @@
|
||||
# name: test/fuzzer/sqlsmith/json_contains_null.test
|
||||
# description: JSON Contains with NULL varchar parameters
|
||||
# group: [sqlsmith]
|
||||
|
||||
require json
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
query I
|
||||
SELECT json_contains(NULL::VARCHAR, NULL::VARCHAR);
|
||||
----
|
||||
NULL
|
||||
|
||||
query I
|
||||
WITH cte AS (
|
||||
SELECT NULL::VARCHAR j
|
||||
FROM range(1)
|
||||
)
|
||||
SELECT json_contains(j, j)
|
||||
FROM cte
|
||||
----
|
||||
NULL
|
||||
@@ -0,0 +1,11 @@
|
||||
# name: test/fuzzer/sqlsmith/like_null_pattern.test
|
||||
# description: Test LIKE with a NULL pattern
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
query I
|
||||
SELECT current_schema() ~~ CAST(NULL AS VARCHAR)
|
||||
----
|
||||
NULL
|
||||
@@ -0,0 +1,12 @@
|
||||
# name: test/fuzzer/sqlsmith/mad_overflow.test
|
||||
# description: Prevent INT128 overflow during interpolation
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
create table all_types as
|
||||
select * exclude(small_enum, medium_enum, large_enum)
|
||||
from test_all_types();
|
||||
|
||||
statement ok
|
||||
SELECT mad(dec38_10)
|
||||
FROM all_types;
|
||||
@@ -0,0 +1,20 @@
|
||||
# name: test/fuzzer/sqlsmith/makedate_overflow.test
|
||||
# description: Trap overflow from INT64 => INT32
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
create table all_types as
|
||||
select * exclude(small_enum, medium_enum, large_enum)
|
||||
from test_all_types();
|
||||
|
||||
statement error
|
||||
SELECT make_timestamp("bigint", "bigint", "bigint", "bigint", "bigint", "double")
|
||||
FROM all_types;
|
||||
----
|
||||
can't be cast because the value is out of range for the destination type INT32
|
||||
|
||||
statement error
|
||||
SELECT make_date(c1)
|
||||
FROM test_vector_types(CAST(NULL AS STRUCT("year" BIGINT, "month" BIGINT, "day" BIGINT))) AS test_vector_types(c1);
|
||||
----
|
||||
the value is out of range for the destination type INT32
|
||||
@@ -0,0 +1,52 @@
|
||||
# name: test/fuzzer/sqlsmith/nested_correlated_subquery.test
|
||||
# description: Test nested correlated subquery
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE t(ps_supplycost INT, n_name INT);
|
||||
|
||||
statement ok
|
||||
SELECT NULL
|
||||
FROM
|
||||
t AS ref_2,
|
||||
(SELECT (SELECT NULL
|
||||
FROM (FROM t AS ref_5,
|
||||
(SELECT ref_2.n_name AS c1))));
|
||||
|
||||
query I
|
||||
SELECT NULL
|
||||
FROM
|
||||
t AS ref_2,
|
||||
(SELECT (SELECT NULL
|
||||
FROM (FROM t AS ref_5,
|
||||
(SELECT ref_5.ps_supplycost AS c0,
|
||||
ref_2.n_name AS c1))));
|
||||
----
|
||||
|
||||
# postgres compatible with explicit LATERAL annotations
|
||||
query I
|
||||
SELECT NULL
|
||||
FROM
|
||||
t AS ref_2,
|
||||
LATERAL (SELECT (SELECT NULL
|
||||
FROM (SELECT * FROM t AS ref_5,
|
||||
LATERAL (SELECT ref_5.ps_supplycost AS c0,
|
||||
ref_2.n_name AS c1) AS alias1) AS alias2) AS alias3) AS alias4;
|
||||
----
|
||||
|
||||
statement ok
|
||||
INSERT INTO t VALUES (1, 100);
|
||||
|
||||
query III
|
||||
SELECT *
|
||||
FROM
|
||||
t AS ref_2,
|
||||
LATERAL (SELECT (SELECT NULL
|
||||
FROM (SELECT * FROM t AS ref_5,
|
||||
LATERAL (SELECT ref_5.ps_supplycost AS c0,
|
||||
ref_2.n_name AS c1) AS alias1) AS alias2) AS alias3) AS alias4;
|
||||
----
|
||||
1 100 NULL
|
||||
@@ -0,0 +1,25 @@
|
||||
# name: test/fuzzer/sqlsmith/nullif_map.test
|
||||
# description: Test nullif on maps
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE tbl(map MAP(VARCHAR, VARCHAR));;
|
||||
|
||||
statement ok
|
||||
INSERT INTO tbl VALUES(MAP([], []));
|
||||
|
||||
statement ok
|
||||
INSERT INTO tbl VALUES(MAP(['key1', 'key2'], ['🦆🦆🦆🦆🦆🦆', 'goose']));
|
||||
|
||||
statement ok
|
||||
INSERT INTO tbl VALUES(NULL);
|
||||
|
||||
query I
|
||||
SELECT nullif(ref_2."map", ref_2."map") FROM tbl AS ref_2 ORDER BY rowid;
|
||||
----
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
@@ -0,0 +1,72 @@
|
||||
# name: test/fuzzer/sqlsmith/nullif_map_with_config.test
|
||||
# description: Test nullif on maps with config (internal issue 5232)
|
||||
# group: [sqlsmith]
|
||||
|
||||
require no_alternative_verify
|
||||
|
||||
load __TEST_DIR__/nullif_map_issue.db
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
SET default_block_size = 262144;
|
||||
|
||||
statement ok
|
||||
SET storage_compatibility_version = 'latest';
|
||||
|
||||
statement ok
|
||||
SET max_memory = '1234kb';
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/issue5232.db' AS issue5232 (STORAGE_VERSION 'latest');
|
||||
|
||||
statement ok
|
||||
USE issue5232;
|
||||
|
||||
statement ok
|
||||
CREATE TABLE tbl(map MAP(VARCHAR, VARCHAR));
|
||||
|
||||
statement ok
|
||||
INSERT INTO tbl VALUES(MAP([], []));
|
||||
|
||||
statement error
|
||||
INSERT INTO tbl VALUES(MAP(['key1', 'key2'], ['🦆🦆🦆🦆🦆🦆', 'goose']));
|
||||
----
|
||||
TransactionContext Error: Failed to commit: could not allocate block
|
||||
|
||||
statement ok
|
||||
USE nullif_map_issue;
|
||||
|
||||
statement ok
|
||||
DETACH issue5232;
|
||||
|
||||
# Now try with 16kB blocks.
|
||||
# The base table has a size of 32768 bytes (2 blocks): 32kB < 1234kB,
|
||||
# so we expect the test to succeed.
|
||||
|
||||
restart
|
||||
|
||||
statement ok
|
||||
SET default_block_size = 16384;
|
||||
|
||||
statement ok
|
||||
SET storage_compatibility_version = 'latest';
|
||||
|
||||
statement ok
|
||||
SET max_memory = '1234kb';
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/issue5232_small.db' (STORAGE_VERSION 'latest');
|
||||
|
||||
statement ok
|
||||
USE issue5232_small;
|
||||
|
||||
statement ok
|
||||
CREATE TABLE tbl(map MAP(VARCHAR, VARCHAR));
|
||||
|
||||
statement ok
|
||||
INSERT INTO tbl VALUES(MAP([], []));
|
||||
|
||||
statement ok
|
||||
INSERT INTO tbl VALUES(MAP(['key1', 'key2'], ['🦆🦆🦆🦆🦆🦆', 'goose']));
|
||||
@@ -0,0 +1,55 @@
|
||||
# name: test/fuzzer/sqlsmith/statistics_assertion_trigger.test
|
||||
# description: Fuzzer #61: statistics assert
|
||||
# group: [sqlsmith]
|
||||
|
||||
# FIXME
|
||||
mode skip
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
create table all_types as select * exclude(small_enum, medium_enum, large_enum) from test_all_types();
|
||||
|
||||
statement ok
|
||||
SELECT NULL AS c3
|
||||
FROM
|
||||
(SELECT NULL AS c0,
|
||||
NULL AS c1,
|
||||
NULL AS c2
|
||||
FROM main.all_types AS ref_0
|
||||
INNER JOIN main.all_types AS ref_1
|
||||
INNER JOIN main.all_types AS ref_2
|
||||
LEFT JOIN main.all_types AS ref_3 ON (ref_2."struct" = ref_3."struct") ON (ref_3."varchar") ON (ref_1."varchar")
|
||||
LEFT JOIN main.all_types AS ref_4
|
||||
INNER JOIN main.all_types AS ref_5 ON (NULL) ON (ref_0."double" = ref_5."double")) AS subq_0
|
||||
WHERE EXISTS
|
||||
(SELECT NULL AS c0,
|
||||
NULL AS c1,
|
||||
NULL AS c2,
|
||||
NULL AS c3,
|
||||
NULL AS c4,
|
||||
NULL AS c5,
|
||||
NULL AS c6,
|
||||
NULL AS c7
|
||||
FROM
|
||||
(SELECT NULL AS c1) AS subq_1
|
||||
WHERE (
|
||||
(SELECT 'duck') ~~ CASE
|
||||
WHEN ((subq_0.c1 IS NOT NULL)) THEN (CASE
|
||||
WHEN ((
|
||||
(SELECT 'duck') ~~
|
||||
(SELECT 'duck'))) THEN (
|
||||
(SELECT 'duck'))
|
||||
ELSE
|
||||
(SELECT 'duck')
|
||||
END)
|
||||
ELSE CASE
|
||||
WHEN ((
|
||||
(SELECT 'duck') ~~
|
||||
(SELECT 'duck'))) THEN (
|
||||
(SELECT 'duck'))
|
||||
ELSE
|
||||
(SELECT 'duck')
|
||||
END
|
||||
END))
|
||||
@@ -0,0 +1,17 @@
|
||||
# name: test/fuzzer/sqlsmith/strptime_nullpointer.test
|
||||
# description: Fuzzer #45: nullpointer in strptime call
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE t0(c0 BOOLEAN DEFAULT(true), c1 VARCHAR);
|
||||
|
||||
statement ok
|
||||
INSERT INTO t0(c0, c1) VALUES (534898561, 1156365055), (524523641, '0.46680525959210206');
|
||||
|
||||
statement error
|
||||
SELECT NULL FROM t0 ORDER BY strptime(NOT(t0.c0 BETWEEN t0.rowid AND t0.rowid), 1407974306)
|
||||
----
|
||||
Binder Error: No function matches the given name and argument types 'strptime
|
||||
@@ -0,0 +1,18 @@
|
||||
# name: test/fuzzer/sqlsmith/struct_null_coalesce_assert.test
|
||||
# description: Assertion trigger in coalesce with null structs
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE struct_tbl("struct" STRUCT(a INTEGER, b VARCHAR));
|
||||
|
||||
query I
|
||||
SELECT CAST(COALESCE(CAST(NULL AS STRUCT(a INTEGER, b VARCHAR)), CAST(NULL AS STRUCT(a INTEGER, b VARCHAR))) AS STRUCT(a INTEGER, b VARCHAR))
|
||||
----
|
||||
NULL
|
||||
|
||||
statement ok
|
||||
INSERT INTO struct_tbl (VALUES (CAST(COALESCE(CAST(NULL AS STRUCT(a INTEGER, b VARCHAR)), CAST(NULL AS STRUCT(a INTEGER, b VARCHAR))) AS STRUCT(a INTEGER, b VARCHAR))));
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# name: test/fuzzer/sqlsmith/struct_verify_crash.test
|
||||
# description: Fuzzer #52: AddressSanitizer error in duckdb::string_t::VerifyNull() string_type.cpp:30
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE tbl(array_of_structs STRUCT(a INTEGER, b VARCHAR)[]);
|
||||
|
||||
statement ok
|
||||
INSERT INTO tbl VALUES([]);
|
||||
|
||||
statement ok
|
||||
INSERT INTO tbl VALUES([{'a': 42, 'b': '🦆🦆🦆🦆🦆🦆'}]);
|
||||
|
||||
query I
|
||||
SELECT EXISTS(SELECT ref_1.array_of_structs AS c1) FROM tbl AS ref_0, tbl AS ref_1
|
||||
----
|
||||
true
|
||||
true
|
||||
true
|
||||
true
|
||||
@@ -0,0 +1,29 @@
|
||||
# name: test/fuzzer/sqlsmith/subquery_binding_error.test
|
||||
# description: Fuzzer #57: subquery binding error
|
||||
# group: [sqlsmith]
|
||||
|
||||
# FIXME
|
||||
mode skip
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE all_types("varchar" VARCHAR);
|
||||
|
||||
statement ok
|
||||
INSERT INTO all_types VALUES('🦆🦆🦆🦆🦆🦆');
|
||||
|
||||
query I
|
||||
SELECT NULL AS c1
|
||||
FROM
|
||||
(SELECT NULL AS c2) AS subq_0
|
||||
LEFT JOIN
|
||||
(SELECT DISTINCT
|
||||
ref_3."varchar" AS c7
|
||||
FROM all_types AS ref_3
|
||||
WHERE EXISTS(
|
||||
SELECT ref_3."varchar" AS c3)) AS subq_1
|
||||
ON ((subq_1.c7 ~~ (SELECT "varchar" FROM all_types)))
|
||||
----
|
||||
NULL
|
||||
@@ -0,0 +1,24 @@
|
||||
# name: test/fuzzer/sqlsmith/test_abs_overflow.test
|
||||
# description: Fuzzer #29: test abs overflow
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
# test abs function on extremes
|
||||
|
||||
statement ok
|
||||
CREATE TABLE numerics AS SELECT tinyint, smallint, int, bigint, hugeint FROM test_all_types();
|
||||
|
||||
foreach type tinyint smallint int bigint hugeint
|
||||
|
||||
statement error
|
||||
SELECT abs(${type}) FROM numerics;
|
||||
----
|
||||
Overflow on abs
|
||||
|
||||
statement ok
|
||||
SELECT abs(${type}) FROM numerics WHERE ${type} > 0;
|
||||
|
||||
endloop
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# name: test/fuzzer/sqlsmith/timestamp_diff_overflow.test
|
||||
# description: Test overflow in timestamp subtract
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE ts("timestamp" TIMESTAMP);;
|
||||
|
||||
statement ok
|
||||
INSERT INTO ts VALUES('290309-12-22 (BC) 00:00:00');
|
||||
|
||||
statement ok
|
||||
INSERT INTO ts VALUES('294247-01-10 04:00:54.775806');
|
||||
|
||||
statement ok
|
||||
INSERT INTO ts VALUES(NULL);
|
||||
|
||||
statement error
|
||||
select
|
||||
subtract(
|
||||
cast(now() as timestamp),
|
||||
cast(ref_0.timestamp as timestamp)) as c10
|
||||
from
|
||||
ts as ref_0
|
||||
----
|
||||
Conversion Error: Timestamp difference is out of bounds
|
||||
@@ -0,0 +1,17 @@
|
||||
# name: test/fuzzer/sqlsmith/timestamp_overflow.test
|
||||
# description: Test timestamp - bigint overflow
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
create table all_types as
|
||||
select * exclude(small_enum, medium_enum, large_enum)
|
||||
from test_all_types();
|
||||
|
||||
statement error
|
||||
SELECT c15
|
||||
FROM
|
||||
all_types AS t41(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40)
|
||||
FULL JOIN
|
||||
(SELECT NULL) ON (list_mad(c34))
|
||||
----
|
||||
Out of Range Error: Overflow in timestamp subtraction
|
||||
@@ -0,0 +1,25 @@
|
||||
# name: test/fuzzer/sqlsmith/timestamptz_double_cast.test
|
||||
# description: Test cast from large double to seconds
|
||||
# group: [sqlsmith]
|
||||
|
||||
require icu
|
||||
|
||||
statement ok
|
||||
create table all_types as
|
||||
select * exclude(small_enum, medium_enum, large_enum)
|
||||
from test_all_types();
|
||||
|
||||
statement error
|
||||
SELECT
|
||||
arg_min(CAST(ref_0.timestamp_tz AS TIMESTAMP WITH TIME ZONE),
|
||||
CAST(make_timestamptz(
|
||||
CAST(ref_0."bigint" AS BIGINT),
|
||||
CAST(ref_0."bigint" AS BIGINT),
|
||||
CAST(ref_0."bigint" AS BIGINT),
|
||||
CAST(ref_0."bigint" AS BIGINT),
|
||||
CAST(txid_current() AS BIGINT),
|
||||
CAST(ref_0."bigint" AS BIGINT)) AS TIMESTAMP WITH TIME ZONE))
|
||||
OVER (PARTITION BY ref_0."smallint" ORDER BY ref_0.int_array) AS c2
|
||||
FROM main.all_types AS ref_0
|
||||
----
|
||||
Invalid Input Error: Type INT64 with value
|
||||
@@ -0,0 +1,19 @@
|
||||
# name: test/fuzzer/sqlsmith/timestamptz_null_range.test
|
||||
# description: Check range bounds for NULL
|
||||
# group: [sqlsmith]
|
||||
|
||||
require icu
|
||||
|
||||
require no_extension_autoloading "FIXME: generate_series(TIMESTAMP WITH TIME ZONE,...) currently do not autoload ICU"
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
query I
|
||||
SELECT NULL FROM (
|
||||
SELECT 4767
|
||||
FROM generate_series(CAST('290309-12-22 (BC) 00:00:00+00' AS TIMESTAMP WITH TIME ZONE), NULL, NULL)
|
||||
AS t6(c1, c2, c3, c4, c5)
|
||||
)
|
||||
AS t64
|
||||
----
|
||||
@@ -0,0 +1,21 @@
|
||||
# name: test/fuzzer/sqlsmith/validity_mask_out_of_bounds.test
|
||||
# description: Fuzzer #54: test validity mask out of bounds
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE all_types(struct_of_arrays STRUCT(a INTEGER[], b VARCHAR[]), "smallint" SMALLINT);;
|
||||
|
||||
statement ok
|
||||
INSERT INTO all_types VALUES({'a': NULL, 'b': NULL}, -32768);
|
||||
|
||||
statement ok
|
||||
INSERT INTO all_types VALUES({'a': [42, 999, NULL, NULL, -42], 'b': ['🦆🦆🦆🦆🦆🦆', 'goose', NULL, ]}, 32767);
|
||||
|
||||
query I rowsort
|
||||
SELECT ref_2.struct_of_arrays AS c3 FROM main.all_types AS ref_0 RIGHT JOIN main.all_types AS ref_1 INNER JOIN main.all_types AS ref_2 ON (ref_1."smallint" = ref_2."smallint") ON (NULL)
|
||||
----
|
||||
{'a': NULL, 'b': NULL}
|
||||
{'a': [42, 999, NULL, NULL, -42], 'b': [🦆🦆🦆🦆🦆🦆, goose, NULL]}
|
||||
@@ -0,0 +1,15 @@
|
||||
# name: test/fuzzer/sqlsmith/window-leadlag-overflow.test
|
||||
# description: Lead/Lag Arithmetic Overflow
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement error
|
||||
WITH all_types AS (
|
||||
select * exclude(small_enum, medium_enum, large_enum) from test_all_types()
|
||||
)
|
||||
SELECT lag(c16, COLUMNS(*)) OVER (ROWS BETWEEN 1768 FOLLOWING AND UNBOUNDED FOLLOWING)
|
||||
FROM all_types AS t42(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41)
|
||||
----
|
||||
the value is out of range for the destination type
|
||||
|
||||
statement ok
|
||||
SELECT lead('1e668c84-6cbc-4d41-843e-970c17446f9e', 8479, 3087) OVER (PARTITION BY 9136)
|
||||
@@ -0,0 +1,16 @@
|
||||
# name: test/fuzzer/sqlsmith/window-list-value.test
|
||||
# description: NULL List Values
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
create table all_types as select * exclude(small_enum, medium_enum, large_enum)
|
||||
from test_all_types();
|
||||
|
||||
query I
|
||||
SELECT first_value(c39) OVER (PARTITION BY c41 ROWS BETWEEN #4 FOLLOWING AND UNBOUNDED FOLLOWING)
|
||||
FROM all_types AS t42(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42)
|
||||
ORDER BY ALL
|
||||
----
|
||||
{'a': NULL, 'b': NULL}
|
||||
NULL
|
||||
NULL
|
||||
@@ -0,0 +1,60 @@
|
||||
# name: test/fuzzer/sqlsmith/window-rows-overflow.test
|
||||
# description: Overflow testing for rows offsets.
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
create table all_types as
|
||||
select * exclude(
|
||||
small_enum,
|
||||
medium_enum,
|
||||
large_enum,
|
||||
)
|
||||
from test_all_types();
|
||||
|
||||
query I
|
||||
SELECT nth_value(1929, 42) OVER (
|
||||
PARTITION BY (
|
||||
"usmallint" > "smallint"
|
||||
), 747 ROWS BETWEEN "bigint" PRECEDING AND CURRENT ROW
|
||||
)
|
||||
FROM all_types;
|
||||
----
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
|
||||
query I
|
||||
SELECT nth_value(1929, 42) OVER (
|
||||
PARTITION BY (
|
||||
"usmallint" > "smallint"
|
||||
), 747 ROWS BETWEEN 1 PRECEDING AND "bigint" PRECEDING
|
||||
)
|
||||
FROM all_types;
|
||||
----
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
|
||||
query I
|
||||
SELECT nth_value(1929, 42) OVER (
|
||||
PARTITION BY (
|
||||
"usmallint" > "smallint"
|
||||
), 747 ROWS BETWEEN "bigint" FOLLOWING AND 1 FOLLOWING
|
||||
)
|
||||
FROM all_types;
|
||||
----
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
|
||||
query I
|
||||
SELECT nth_value(1929, 42) OVER (
|
||||
PARTITION BY (
|
||||
"usmallint" > "smallint"
|
||||
), 747 ROWS BETWEEN CURRENT ROW AND "bigint" FOLLOWING
|
||||
)
|
||||
FROM all_types;
|
||||
----
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
@@ -0,0 +1,15 @@
|
||||
# name: test/fuzzer/sqlsmith/window_function_error.test
|
||||
# description: Correctly handle errors in window expressions
|
||||
# group: [sqlsmith]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE tbl AS SELECT 'thisisastring42' AS r_name;
|
||||
|
||||
statement error
|
||||
SELECT max(CAST(from_hex(CAST(ref_0.r_name AS VARCHAR)) AS BLOB)) OVER (ORDER BY ref_0.r_name) AS c5,
|
||||
FROM tbl AS ref_0
|
||||
----
|
||||
Invalid Input Error: Invalid input for hex digit: t
|
||||
@@ -0,0 +1,27 @@
|
||||
# name: test/fuzzer/sqlsmith/window_scalar_range.test
|
||||
# description: Test various RANGE types
|
||||
# group: [sqlsmith]
|
||||
|
||||
# Constant ORDER BY
|
||||
statement ok
|
||||
CREATE TABLE partsupp AS SELECT (random() * 100)::INT AS c2
|
||||
FROM range(8000);
|
||||
|
||||
statement ok
|
||||
SELECT percent_rank()
|
||||
OVER (ORDER BY 7543 ASC NULLS FIRST
|
||||
RANGE BETWEEN c2 PRECEDING AND c2 FOLLOWING)
|
||||
FROM partsupp;
|
||||
|
||||
# LIST + ARRAY
|
||||
statement ok
|
||||
create table all_types as
|
||||
select * exclude(small_enum, medium_enum, large_enum)
|
||||
from test_all_types();
|
||||
|
||||
statement error
|
||||
SELECT NULL
|
||||
FROM all_types AS t51(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51)
|
||||
QUALIFY row_number() OVER (ORDER BY main.list_value() ASC NULLS FIRST RANGE BETWEEN c44 FOLLOWING AND UNBOUNDED FOLLOWING)
|
||||
----
|
||||
Invalid type for Window RANGE expression
|
||||
Reference in New Issue
Block a user