blob: 2c2c3d34db9a6065b9c93f619858121e4cb104d8 [file] [log] [blame]
# name: test/sql/order/test_limit.test
# description: Test LIMIT keyword
# group: [order]
statement ok
PRAGMA enable_verification
statement ok
CREATE TABLE test (a INTEGER, b INTEGER);
statement ok
INSERT INTO test VALUES (11, 22), (12, 21), (13, 22)
# constant limit
query I
SELECT a FROM test ORDER BY a LIMIT 1
----
11
# LIMIT with non-scalar should fail
statement error
SELECT a FROM test LIMIT a
# LIMIT with non-scalar operation should also fail
statement error
SELECT a FROM test LIMIT a+1
# aggregate in limit
statement error
SELECT a FROM test LIMIT SUM(42)
# window function in limit
statement error
SELECT a FROM test LIMIT row_number() OVER ()
# LIMIT Bug #321 Crazy Result
statement ok
CREATE TABLE test2 (a VARCHAR);
statement ok
INSERT INTO test2 VALUES ('Hello World')
# can only limit by integers
statement error
select 1 limit date '1992-01-01';