File: misc.result

package info (click to toggle)
tarantool 2.6.0-1.4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 85,412 kB
  • sloc: ansic: 513,775; cpp: 69,493; sh: 25,650; python: 19,190; perl: 14,973; makefile: 4,178; yacc: 1,329; sql: 1,074; pascal: 620; ruby: 190; awk: 18; lisp: 7
file content (206 lines) | stat: -rw-r--r-- 4,473 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
test_run = require('test_run').new()
---
...
engine = test_run:get_cfg('engine')
---
...
_ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
---
...
-- Forbid multistatement queries.
box.execute('select 1;')
---
- metadata:
  - name: COLUMN_1
    type: integer
  rows:
  - [1]
...
box.execute('select 1; select 2;')
---
- null
- 'At line 1 at or near position 11: keyword ''select'' is reserved. Please use double
  quotes if ''select'' is an identifier.'
...
box.execute('create table t1 (id INT primary key); select 100;')
---
- null
- 'At line 1 at or near position 39: keyword ''select'' is reserved. Please use double
  quotes if ''select'' is an identifier.'
...
box.space.t1 == nil
---
- true
...
box.execute(';')
---
- null
- Failed to execute an empty SQL statement
...
box.execute('')
---
- null
- Failed to execute an empty SQL statement
...
box.execute('     ;')
---
- null
- Failed to execute an empty SQL statement
...
box.execute('\n\n\n\t\t\t   ')
---
- null
- Failed to execute an empty SQL statement
...
-- gh-3820: only table constraints can have a name.
--
box.execute('CREATE TABLE test (id INTEGER PRIMARY KEY, b INTEGER CONSTRAINT c1 NULL)')
---
- null
- 'At line 1 at or near position 68: keyword ''NULL'' is reserved. Please use double
  quotes if ''NULL'' is an identifier.'
...
box.execute('CREATE TABLE test (id INTEGER PRIMARY KEY, b INTEGER CONSTRAINT c1 DEFAULT 300)')
---
- null
- 'At line 1 at or near position 68: keyword ''DEFAULT'' is reserved. Please use double
  quotes if ''DEFAULT'' is an identifier.'
...
box.execute('CREATE TABLE test (id INTEGER PRIMARY KEY, b TEXT CONSTRAINT c1 COLLATE "binary")')
---
- null
- 'At line 1 at or near position 65: keyword ''COLLATE'' is reserved. Please use double
  quotes if ''COLLATE'' is an identifier.'
...
-- Make sure that type of literals in meta complies with its real
-- type. For instance, typeof(0.5) is number, not integer.
--
box.execute('SELECT 1;')
---
- metadata:
  - name: COLUMN_1
    type: integer
  rows:
  - [1]
...
box.execute('SELECT 1.5;')
---
- metadata:
  - name: COLUMN_1
    type: double
  rows:
  - [1.5]
...
box.execute('SELECT 1.0;')
---
- metadata:
  - name: COLUMN_1
    type: double
  rows:
  - [1]
...
box.execute('SELECT \'abc\';')
---
- metadata:
  - name: COLUMN_1
    type: string
  rows:
  - ['abc']
...
box.execute('SELECT X\'4D6564766564\'')
---
- metadata:
  - name: COLUMN_1
    type: varbinary
  rows:
  - ['Medved']
...
--
-- gh-4139: assertion when reading a temporary space.
--
format = {{name = 'id', type = 'integer'}}
---
...
s = box.schema.space.create('s',{format=format, temporary=true})
---
...
i = s:create_index('i')
---
...
box.execute('select * from "s"')
---
- metadata:
  - name: id
    type: integer
  rows: []
...
s:drop()
---
...
--
-- gh-4267: Full power of vdbe_field_ref
-- Tarantool's SQL internally stores data offset for all acceded
-- fields. It also keeps a bitmask of size 64 with all initialized
-- slots in actual state to find the nearest left field really
-- fast and parse tuple from that position. For fieldno >= 64
-- bitmask is not applicable, so it scans data offsets area in
-- a cycle.
--
-- The test below covers a case when this optimisation doesn't
-- work and the second lookup require parsing tuple from
-- beginning.
---
format = {}
---
...
t = {}
---
...
for i = 1, 70 do                                                \
        format[i] = {name = 'FIELD'..i, type = 'unsigned'}      \
        t[i] = i                                                \
end
---
...
s = box.schema.create_space('TEST', {format = format})
---
...
pk = s:create_index('pk', {parts = {70}})
---
...
s:insert(t)
---
- [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
  23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
  43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
  63, 64, 65, 66, 67, 68, 69, 70]
...
box.execute('SELECT field70, field64 FROM test')
---
- metadata:
  - name: FIELD70
    type: unsigned
  - name: FIELD64
    type: unsigned
  rows:
  - [70, 64]
...
-- In the case below described optimization works fine.
pk:alter({parts = {66}})
---
...
box.execute('SELECT field66, field68, field70 FROM test')
---
- metadata:
  - name: FIELD66
    type: unsigned
  - name: FIELD68
    type: unsigned
  - name: FIELD70
    type: unsigned
  rows:
  - [66, 68, 70]
...
box.space.TEST:drop()
---
...