54 lines
1.2 KiB
SQL
54 lines
1.2 KiB
SQL
# name: test/fuzzer/pedro/index_current_timestamp.test
|
|
# description: Get current timestamp and similar functions cannot be used in indexes
|
|
# group: [pedro]
|
|
|
|
load __TEST_DIR__/index_current_timestamp.db
|
|
|
|
statement ok
|
|
CREATE TABLE t1(c0 INT, c1 VARCHAR);
|
|
|
|
statement ok
|
|
INSERT INTO t1(c1) VALUES(1);
|
|
|
|
statement ok
|
|
CREATE SEQUENCE seq
|
|
|
|
statement error
|
|
CREATE INDEX i1 ON t1((get_current_timestamp()), c1);
|
|
----
|
|
Index keys cannot contain expressions with side effects.
|
|
|
|
statement error
|
|
CREATE INDEX i1 ON t1((random()), c1);
|
|
----
|
|
Index keys cannot contain expressions with side effects.
|
|
|
|
statement error
|
|
CREATE INDEX i1 ON t1((nextval('seq')), c1);
|
|
----
|
|
Index keys cannot contain expressions with side effects.
|
|
|
|
statement ok
|
|
DELETE FROM t1;
|
|
|
|
# now with an empty table
|
|
|
|
statement error
|
|
CREATE INDEX i1 ON t1((get_current_timestamp()), c1);
|
|
----
|
|
Index keys cannot contain expressions with side effects.
|
|
|
|
# but attempting to insert a value borks it up
|
|
statement ok
|
|
INSERT INTO t1 VALUES (42, 'hello')
|
|
|
|
restart
|
|
|
|
statement error
|
|
CREATE INDEX i1 ON t1((get_current_timestamp()), c1);
|
|
----
|
|
Index keys cannot contain expressions with side effects.
|
|
|
|
statement ok
|
|
INSERT INTO t1 VALUES (42, 'hello')
|