54 lines
920 B
SQL
54 lines
920 B
SQL
# name: test/sql/select/test_positional_reference.test
|
|
# description: Positional reference
|
|
# group: [select]
|
|
|
|
statement ok
|
|
PRAGMA enable_verification
|
|
|
|
query I
|
|
SELECT #1 FROM range(1)
|
|
----
|
|
0
|
|
|
|
# multiple tables
|
|
query I
|
|
SELECT #1+#2 FROM range(1) tbl, range(1) tbl2
|
|
----
|
|
0
|
|
|
|
# subqueries
|
|
query I
|
|
SELECT #1 FROM (SELECT * FROM range(1)) tbl
|
|
----
|
|
0
|
|
|
|
# positional references only consider the inner-most table
|
|
statement error
|
|
select (select #1) from range(1);
|
|
----
|
|
<REGEX>:.*Binder Error.*out of range.*
|
|
|
|
# out of range
|
|
statement error
|
|
SELECT #2 FROM range(1)
|
|
----
|
|
<REGEX>:.*Binder Error.*out of range.*
|
|
|
|
# no from clause
|
|
statement error
|
|
SELECT #1
|
|
----
|
|
<REGEX>:.*Binder Error.*out of range.*
|
|
|
|
# zero always fails
|
|
statement error
|
|
SELECT #0 FROM range(1)
|
|
----
|
|
<REGEX>:.*Parser Error.*Positional reference node needs.*
|
|
|
|
# as do negative numbers
|
|
statement error
|
|
SELECT #-1 FROM range(1)
|
|
----
|
|
<REGEX>:.*Parser Error.*syntax error.*
|