-
Notifications
You must be signed in to change notification settings - Fork 607
Open
Description
turso> SELECT
id,
(VALUES(name)) AS name_again
FROM users;
┌────┬────────────┐
│ id │ name_again │
├────┼────────────┤
│ 1 │ name │
├────┼────────────┤
│ 2 │ name │
└────┴────────────┘
sqlite> SELECT
...> id,
...> (VALUES(name)) AS name_again
...> FROM users;
1|jack
2|jill
The query plans reflect the same. The identifier 'name' is not being resolved in turso:
turso> explain select id, (values(name)) as name_again from users;
addr opcode p1 p2 p3 p4 p5 comment
---- ----------------- ---- ---- ---- ------------- -- -------
0 Init 0 14 0 0 Start at 14
1 Once 7 0 0 0 goto 7
2 BeginSubrtn 2 0 0 0 r[2]=NULL
3 Null 0 1 0 0 r[1]=NULL
4 String8 0 3 0 name 0 r[3]='name'
5 Copy 3 1 0 0 r[1]=r[3]
6 Return 2 0 1 0
7 OpenRead 0 2 0 0 table=users, root=2, iDb=0
8 Rewind 0 13 0 0 Rewind table users
9 RowId 0 4 0 0 r[4]=users.rowid
10 Copy 1 5 0 0 r[5]=r[1]
11 ResultRow 4 2 0 0 output=r[4..5]
12 Next 0 9 0 0
13 Halt 0 0 0 0
14 Transaction 0 1 18 0 iDb=0 tx_mode=Read
15 Goto 0 1 0 0
sqlite> explain select id, (values(name)) as name_again from users;
addr opcode p1 p2 p3 p4 p5 comment
---- ------------- ---- ---- ---- ------------- -- -------------
0 Init 0 14 0 0 Start at 14
1 OpenRead 0 2 0 2 0 root=2 iDb=0; users
2 Rewind 0 13 0 0
3 Rowid 0 1 0 0 r[1]=users.rowid
4 BeginSubrtn 0 3 0 0 r[3]=NULL
5 Null 0 4 4 0 r[4..4]=NULL; Init subquery result
6 Integer 1 5 0 0 r[5]=1; LIMIT counter
7 Column 0 1 4 0 r[4]= cursor 0 column 1
8 DecrJumpZero 5 9 0 0 if (--r[5])==0 goto 9
9 Return 3 5 1 0
10 Copy 4 2 0 0 r[2]=r[4]
11 ResultRow 1 2 0 0 output=r[1..2]
12 Next 0 3 0 1
13 Halt 0 0 0 0
14 Transaction 0 0 18 0 1 usesStmtJournal=0
15 Goto 0 1 0 0
Metadata
Metadata
Assignees
Labels
No labels