backquote.sim 7.7 KB
Newer Older
P
plum-lihui 已提交
1 2 3 4 5
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect

S
Shengliang Guan 已提交
6

P
plum-lihui 已提交
7 8 9
print =============== create database
sql create database `database`
sql create database `DataBase`
X
Xiaoyu Wang 已提交
10
sql select * from information_schema.ins_databases
G
Ganlin Zhao 已提交
11
print rows: $rows
P
plum-lihui 已提交
12
print $data00  $data01
G
Ganlin Zhao 已提交
13
print $data10  $data11
P
plum-lihui 已提交
14
print $data20  $data21
15
if $rows != 4 then
P
plum-lihui 已提交
16 17
  return -1
endi
18
if $data20 != database then
P
plum-lihui 已提交
19 20
  return -1
endi
21
if $data30 != DataBase then
P
plum-lihui 已提交
22 23
  return -1
endi
24
if $data00 != information_schema then
P
plum-lihui 已提交
25 26 27 28 29
  return -1
endi

$dbCnt = 0
while $dbCnt < 2
G
Ganlin Zhao 已提交
30
    if $dbCnt == 0 then
P
plum-lihui 已提交
31
        sql use `database`
G
Ganlin Zhao 已提交
32
    else
P
plum-lihui 已提交
33 34
        sql use `DataBase`
    endi
G
Ganlin Zhao 已提交
35

P
plum-lihui 已提交
36 37 38
    $dbCnt = $dbCnt + 1

    print =============== create super table, include all type
P
plum-lihui 已提交
39
    print notes: after nchar show ok, modify binary to nchar
P
plum-lihui 已提交
40 41
    sql create table `stable` (`timestamp` timestamp, `int` int, `binary` binary(16), `nchar` nchar(16)) tags (`float` float, `Binary` binary(16), `Nchar` nchar(16))
    sql create table `Stable` (`timestamp` timestamp, `int` int, `Binary` binary(32), `Nchar` nchar(32)) tags (`float` float, `binary` binary(16), `nchar` nchar(16))
42

P
plum-lihui 已提交
43
    sql show stables
G
Ganlin Zhao 已提交
44
    print rows: $rows
P
plum-lihui 已提交
45 46
    print $data00  $data01
    print $data10  $data11
G
Ganlin Zhao 已提交
47
    if $rows != 2 then
P
plum-lihui 已提交
48 49
      return -1
    endi
G
Ganlin Zhao 已提交
50
    if $data00 != Stable then
H
Haojun Liao 已提交
51
        if $data00 != stable then
P
plum-lihui 已提交
52 53
          return -1
        endi
P
plum-lihui 已提交
54
    endi
H
Haojun Liao 已提交
55 56
    if $data10 != Stable then
        if $data10 != stable then
P
plum-lihui 已提交
57 58
          return -1
        endi
P
plum-lihui 已提交
59
    endi
G
Ganlin Zhao 已提交
60

P
plum-lihui 已提交
61 62 63
    print =============== create child table
    sql create table `table` using `stable` tags(100.0, 'stable+table', 'stable+table')
    sql create table `Table` using `stable` tags(100.1, 'stable+Table', 'stable+Table')
G
Ganlin Zhao 已提交
64

P
plum-lihui 已提交
65
    sql create table `TAble` using `Stable` tags(100.0, 'Stable+TAble', 'Stable+TAble')
G
Ganlin Zhao 已提交
66 67
    sql create table `TABle` using `Stable` tags(100.1, 'Stable+TABle', 'Stable+TABle')

P
plum-lihui 已提交
68
    sql show tables
G
Ganlin Zhao 已提交
69
    print rows: $rows
P
plum-lihui 已提交
70 71 72 73
    print $data00  $data01
    print $data10  $data11
    print $data20  $data21
    print $data30  $data31
G
Ganlin Zhao 已提交
74
    if $rows != 4 then
P
plum-lihui 已提交
75 76
      return -1
    endi
G
Ganlin Zhao 已提交
77

P
plum-lihui 已提交
78 79 80 81 82
    print =============== insert data
    sql insert into `table` values(now+0s, 10, 'table', 'table')(now+1s, 11, 'table', 'table')
    sql insert into `Table` values(now+0s, 20, 'Table', 'Table')(now+1s, 21, 'Table', 'Table')
    sql insert into `TAble` values(now+0s, 30, 'TAble', 'TAble')(now+1s, 31, 'TAble', 'TAble')
    sql insert into `TABle` values(now+0s, 40, 'TABle', 'TABle')(now+4s, 41, 'TABle', 'TABle')
83

P
plum-lihui 已提交
84 85
    print =============== query data
    sql select * from `table`
86
    print rows: $rows
P
plum-lihui 已提交
87 88
    print $data00 $data01 $data02 $data03
    print $data10 $data11 $data12 $data13
G
Ganlin Zhao 已提交
89
    if $rows != 2 then
P
plum-lihui 已提交
90
      return -1
G
Ganlin Zhao 已提交
91 92
    endi
    if $data01 != 10 then
P
plum-lihui 已提交
93
      return -1
G
Ganlin Zhao 已提交
94 95
    endi
    if $data02 != table then
P
plum-lihui 已提交
96
      return -1
G
Ganlin Zhao 已提交
97
    endi
98 99
    if $data03 != table then
      print expect table, actual $data03
P
plum-lihui 已提交
100 101
      return -1
    endi
102 103 104


    print =================> 1
P
plum-lihui 已提交
105
    sql select * from `Table`
G
Ganlin Zhao 已提交
106
    print rows: $rows
P
plum-lihui 已提交
107 108
    print $data00 $data01 $data02 $data03
    print $data10 $data11 $data12 $data13
G
Ganlin Zhao 已提交
109
    if $rows != 2 then
P
plum-lihui 已提交
110
      return -1
G
Ganlin Zhao 已提交
111 112
    endi
    if $data01 != 20 then
P
plum-lihui 已提交
113
      return -1
G
Ganlin Zhao 已提交
114 115
    endi
    if $data02 != Table then
P
plum-lihui 已提交
116
      return -1
G
Ganlin Zhao 已提交
117 118
    endi
    if $data03 != Table then
P
plum-lihui 已提交
119 120
      return -1
    endi
121 122

    print ================>2
P
plum-lihui 已提交
123
    sql select * from `TAble`
G
Ganlin Zhao 已提交
124
    print rows: $rows
P
plum-lihui 已提交
125 126
    print $data00 $data01 $data02 $data03
    print $data10 $data11 $data12 $data13
G
Ganlin Zhao 已提交
127
    if $rows != 2 then
P
plum-lihui 已提交
128
      return -1
G
Ganlin Zhao 已提交
129 130
    endi
    if $data01 != 30 then
P
plum-lihui 已提交
131
      return -1
G
Ganlin Zhao 已提交
132 133
    endi
    if $data02 != TAble then
P
plum-lihui 已提交
134
      return -1
G
Ganlin Zhao 已提交
135 136
    endi
    if $data03 != TAble then
P
plum-lihui 已提交
137 138
      return -1
    endi
G
Ganlin Zhao 已提交
139

P
plum-lihui 已提交
140
    sql select * from `TABle`
G
Ganlin Zhao 已提交
141
    print rows: $rows
P
plum-lihui 已提交
142 143
    print $data00 $data01 $data02 $data03
    print $data10 $data11 $data12 $data13
G
Ganlin Zhao 已提交
144
    if $rows != 2 then
P
plum-lihui 已提交
145
      return -1
G
Ganlin Zhao 已提交
146 147
    endi
    if $data01 != 40 then
P
plum-lihui 已提交
148
      return -1
G
Ganlin Zhao 已提交
149 150
    endi
    if $data02 != TABle then
P
plum-lihui 已提交
151
      return -1
G
Ganlin Zhao 已提交
152 153
    endi
    if $data03 != TABle then
P
plum-lihui 已提交
154 155
      return -1
    endi
G
Ganlin Zhao 已提交
156

157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
    #print =============== query data from st, but not support select * from super table, waiting fix
    #sql select count(*) from `stable`
    #print rows: $rows
    #print $data00 $data01 $data02 $data03
    #if $rows != 1 then
    #  return -1
    #endi
    #if $data00 != 4 then
    #  return -1
    #endi
    #sql select count(*) from `Stable`
    #print rows: $rows
    #print $data00 $data01 $data02 $data03
    #if $rows != 1 then
    #  return -1
    #endi
    #if $data00 != 4 then
P
plum-lihui 已提交
174 175
    #  return -1
    #endi
P
plum-lihui 已提交
176
    #sql select * from `stable`
G
Ganlin Zhao 已提交
177
    #if $rows != 4 then
P
plum-lihui 已提交
178 179 180 181 182 183 184 185 186
    #  return -1
    #endi

endw

print =============== stop and restart taosd
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start

X
Xiaoyu Wang 已提交
187
sql select * from information_schema.ins_databases
G
Ganlin Zhao 已提交
188
print rows: $rows
P
plum-lihui 已提交
189
print $data00  $data01
G
Ganlin Zhao 已提交
190
print $data10  $data11
P
plum-lihui 已提交
191
print $data20  $data21
192
if $rows != 4 then
P
plum-lihui 已提交
193 194
  return -1
endi
195
if $data20 != database then
P
plum-lihui 已提交
196 197
  return -1
endi
198
if $data30 != DataBase then
P
plum-lihui 已提交
199 200
  return -1
endi
201
if $data00 != information_schema then
P
plum-lihui 已提交
202 203 204 205 206
  return -1
endi

$dbCnt = 0
while $dbCnt < 2
G
Ganlin Zhao 已提交
207
    if $dbCnt == 0 then
P
plum-lihui 已提交
208
        sql use `database`
G
Ganlin Zhao 已提交
209
    else
P
plum-lihui 已提交
210 211
        sql use `DataBase`
    endi
G
Ganlin Zhao 已提交
212

P
plum-lihui 已提交
213 214 215
    $dbCnt = $dbCnt + 1

    sql show stables
G
Ganlin Zhao 已提交
216
    print rows: $rows
P
plum-lihui 已提交
217 218
    print $data00  $data01
    print $data10  $data11
G
Ganlin Zhao 已提交
219
    if $rows != 2 then
P
plum-lihui 已提交
220 221
      return -1
    endi
G
Ganlin Zhao 已提交
222
    if $data00 != Stable then
H
Haojun Liao 已提交
223
        if $data00 != stable then
P
plum-lihui 已提交
224 225
          return -1
        endi
P
plum-lihui 已提交
226
    endi
H
Haojun Liao 已提交
227 228
    if $data10 != Stable then
        if $data10 != stable then
P
plum-lihui 已提交
229 230
          return -1
        endi
P
plum-lihui 已提交
231
    endi
G
Ganlin Zhao 已提交
232

P
plum-lihui 已提交
233
    sql show tables
G
Ganlin Zhao 已提交
234
    print rows: $rows
P
plum-lihui 已提交
235 236 237 238
    print $data00  $data01
    print $data10  $data11
    print $data20  $data21
    print $data30  $data31
G
Ganlin Zhao 已提交
239
    if $rows != 4 then
P
plum-lihui 已提交
240 241
      return -1
    endi
G
Ganlin Zhao 已提交
242

P
plum-lihui 已提交
243 244
    print =============== query data
    sql select * from `table`
G
Ganlin Zhao 已提交
245
    print rows: $rows
P
plum-lihui 已提交
246 247
    print $data00 $data01 $data02 $data03
    print $data10 $data11 $data12 $data13
G
Ganlin Zhao 已提交
248
    if $rows != 2 then
P
plum-lihui 已提交
249
      return -1
G
Ganlin Zhao 已提交
250 251
    endi
    if $data01 != 10 then
P
plum-lihui 已提交
252
      return -1
G
Ganlin Zhao 已提交
253 254
    endi
    if $data02 != table then
P
plum-lihui 已提交
255
      return -1
G
Ganlin Zhao 已提交
256 257
    endi
    if $data03 != table then
P
plum-lihui 已提交
258 259
      return -1
    endi
G
Ganlin Zhao 已提交
260

P
plum-lihui 已提交
261
    sql select * from `Table`
G
Ganlin Zhao 已提交
262
    print rows: $rows
P
plum-lihui 已提交
263 264
    print $data00 $data01 $data02 $data03
    print $data10 $data11 $data12 $data13
G
Ganlin Zhao 已提交
265
    if $rows != 2 then
P
plum-lihui 已提交
266
      return -1
G
Ganlin Zhao 已提交
267 268
    endi
    if $data01 != 20 then
P
plum-lihui 已提交
269
      return -1
G
Ganlin Zhao 已提交
270 271
    endi
    if $data02 != Table then
P
plum-lihui 已提交
272
      return -1
G
Ganlin Zhao 已提交
273 274
    endi
    if $data03 != Table then
P
plum-lihui 已提交
275 276
      return -1
    endi
G
Ganlin Zhao 已提交
277

P
plum-lihui 已提交
278
    sql select * from `TAble`
G
Ganlin Zhao 已提交
279
    print rows: $rows
P
plum-lihui 已提交
280 281
    print $data00 $data01 $data02 $data03
    print $data10 $data11 $data12 $data13
G
Ganlin Zhao 已提交
282
    if $rows != 2 then
P
plum-lihui 已提交
283
      return -1
G
Ganlin Zhao 已提交
284 285
    endi
    if $data01 != 30 then
P
plum-lihui 已提交
286
      return -1
G
Ganlin Zhao 已提交
287 288
    endi
    if $data02 != TAble then
P
plum-lihui 已提交
289
      return -1
G
Ganlin Zhao 已提交
290 291
    endi
    if $data03 != TAble then
P
plum-lihui 已提交
292 293
      return -1
    endi
G
Ganlin Zhao 已提交
294

P
plum-lihui 已提交
295
    sql select * from `TABle`
G
Ganlin Zhao 已提交
296
    print rows: $rows
P
plum-lihui 已提交
297 298
    print $data00 $data01 $data02 $data03
    print $data10 $data11 $data12 $data13
G
Ganlin Zhao 已提交
299
    if $rows != 2 then
P
plum-lihui 已提交
300
      return -1
G
Ganlin Zhao 已提交
301 302
    endi
    if $data01 != 40 then
P
plum-lihui 已提交
303
      return -1
G
Ganlin Zhao 已提交
304 305
    endi
    if $data02 != TABle then
P
plum-lihui 已提交
306
      return -1
G
Ganlin Zhao 已提交
307 308
    endi
    if $data03 != TABle then
P
plum-lihui 已提交
309 310
      return -1
    endi
G
Ganlin Zhao 已提交
311

P
plum-lihui 已提交
312 313
    #print =============== query data from st, but not support select * from super table, waiting fix
    #sql select count(*) from `stable`
H
Haojun Liao 已提交
314
    #print rows: $rows
P
plum-lihui 已提交
315
    #print $data00 $data01 $data02 $data03
H
Haojun Liao 已提交
316
    #if $rows != 1 then
P
plum-lihui 已提交
317
    #  return -1
H
Haojun Liao 已提交
318 319
    #endi
    #if $data00 != 4 then
P
plum-lihui 已提交
320
    #  return -1
H
Haojun Liao 已提交
321
    #endi
P
plum-lihui 已提交
322
    #sql select count(*) from `Stable`
H
Haojun Liao 已提交
323
    #print rows: $rows
P
plum-lihui 已提交
324
    #print $data00 $data01 $data02 $data03
H
Haojun Liao 已提交
325
    #if $rows != 1 then
P
plum-lihui 已提交
326
    #  return -1
H
Haojun Liao 已提交
327 328
    #endi
    #if $data00 != 4 then
P
plum-lihui 已提交
329
    #  return -1
H
Haojun Liao 已提交
330
    #endi
P
plum-lihui 已提交
331
    #sql select * from `stable`
G
Ganlin Zhao 已提交
332
    #if $rows != 4 then
P
plum-lihui 已提交
333 334 335 336 337 338
    #  return -1
    #endi

endw


339
system sh/exec.sh -n dnode1 -s stop -x SIGINT