columnValue_int.sim 13.0 KB
Newer Older
S
Shengliang Guan 已提交
1 2 3
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
4
sql connect
S
Shengliang Guan 已提交
5 6 7 8 9

print ========== columnValues.sim

sql drop database if exists db
sql create database db
10 11 12 13 14
sql use db

#### test the value of all data types in four cases: static create table, insert column value, synamic create table, alter tag value

######## case 0: int
G
Ganlin Zhao 已提交
15
print ========== int
16 17 18 19
sql create table mt_int (ts timestamp, c int) tags (tagname int)

## case 00: static create table for test tag values
sql create table st_int_0  using mt_int tags (NULL)
S
Shengliang Guan 已提交
20 21
sql show tags from  st_int_0
if $data05 != NULL then
22 23 24
  return -1
endi
sql create table st_int_1  using mt_int tags (NULL)
S
Shengliang Guan 已提交
25 26
sql show tags from  st_int_1
if $data05 != NULL then
27 28
  return -1
endi
S
Shengliang Guan 已提交
29 30 31 32 33 34

sql_error create table st_int_2  using mt_int tags ('NULL')
sql_error create table st_int_3  using mt_int tags ('NULL')
sql_error create table st_int_4  using mt_int tags ("NULL")
sql_error create table st_int_5  using mt_int tags ("NULL")

35
sql create table st_int_6  using mt_int tags (-2147483647)
S
Shengliang Guan 已提交
36 37
sql show tags from  st_int_6
if $data05 != -2147483647 then
38 39 40
  return -1
endi
sql create table st_int_7  using mt_int tags (2147483647)
S
Shengliang Guan 已提交
41 42
sql show tags from  st_int_7
if $data05 != 2147483647 then
43 44 45
  return -1
endi
sql create table st_int_8  using mt_int tags (37)
S
Shengliang Guan 已提交
46 47
sql show tags from  st_int_8
if $data05 != 37 then
48 49 50
  return -1
endi
sql create table st_int_9  using mt_int tags (-100)
S
Shengliang Guan 已提交
51 52
sql show tags from  st_int_9
if $data05 != -100 then
53 54 55
  return -1
endi
sql create table st_int_10 using mt_int tags (+113)
S
Shengliang Guan 已提交
56 57
sql show tags from  st_int_10
if $data05 != 113 then
58 59 60
  return -1
endi
sql create table st_int_11 using mt_int tags ('-100')
S
Shengliang Guan 已提交
61 62
sql show tags from  st_int_11
if $data05 != -100 then
63 64 65
  return -1
endi
sql create table st_int_12 using mt_int tags ("+78")
S
Shengliang Guan 已提交
66 67
sql show tags from  st_int_12
if $data05 != 78 then
68 69 70
  return -1
endi
sql create table st_int_13 using mt_int tags (+0078)
S
Shengliang Guan 已提交
71 72
sql show tags from  st_int_13
if $data05 != 78 then
73 74 75
  return -1
endi
sql create table st_int_14 using mt_int tags (-00078)
S
Shengliang Guan 已提交
76 77
sql show tags from  st_int_14
if $data05 != -78 then
78 79 80 81 82 83 84 85 86 87 88
  return -1
endi

## case 01: insert values  for test column values
sql insert into st_int_0  values (now, NULL)
sql select * from st_int_0
if $rows != 1 then
  return -1
endi
if $data01 != NULL then
  return -1
G
Ganlin Zhao 已提交
89
endi
90 91 92 93 94 95 96
sql insert into st_int_1  values (now, NULL)
sql select * from st_int_1
if $rows != 1 then
  return -1
endi
if $data01 != NULL then
  return -1
G
Ganlin Zhao 已提交
97
endi
98 99 100 101 102 103 104
sql insert into st_int_6  values (now, 2147483647)
sql select * from st_int_6
if $rows != 1 then
  return -1
endi
if $data01 != 2147483647 then
  return -1
G
Ganlin Zhao 已提交
105
endi
106 107 108 109 110 111 112
sql insert into st_int_7  values (now, -2147483647)
sql select * from st_int_7
if $rows != 1 then
  return -1
endi
if $data01 != -2147483647 then
  return -1
G
Ganlin Zhao 已提交
113 114
endi
sql insert into st_int_8  values (now, +100)
115 116 117 118 119 120
sql select * from st_int_8
if $rows != 1 then
  return -1
endi
if $data01 != 100 then
  return -1
G
Ganlin Zhao 已提交
121
endi
122 123 124 125 126 127 128
sql insert into st_int_9  values (now, "-098")
sql select * from st_int_9
if $rows != 1 then
  return -1
endi
if $data01 != -98 then
  return -1
G
Ganlin Zhao 已提交
129
endi
130 131 132 133 134 135 136
sql insert into st_int_10 values (now, '0')
sql select * from st_int_10
if $rows != 1 then
  return -1
endi
if $data01 != 0 then
  return -1
G
Ganlin Zhao 已提交
137 138
endi
sql insert into st_int_11 values (now, -0)
139 140 141 142 143 144
sql select * from st_int_11
if $rows != 1 then
  return -1
endi
if $data01 != 0 then
  return -1
G
Ganlin Zhao 已提交
145
endi
146 147 148 149 150 151 152
sql insert into st_int_12 values (now, "+056")
sql select * from st_int_12
if $rows != 1 then
  return -1
endi
if $data01 != 56 then
  return -1
G
Ganlin Zhao 已提交
153
endi
154 155 156 157 158 159 160 161

sql insert into st_int_13 values (now, +056)
sql select * from st_int_13
if $rows != 1 then
  return -1
endi
if $data01 != 56 then
  return -1
G
Ganlin Zhao 已提交
162
endi
163 164 165 166 167 168 169 170

sql insert into st_int_14 values (now, -056)
sql select * from st_int_14
if $rows != 1 then
  return -1
endi
if $data01 != -56 then
  return -1
G
Ganlin Zhao 已提交
171
endi
172 173 174

## case 02: dynamic create table for test tag values
sql insert into st_int_16 using mt_int tags (NULL)   values (now, NULL)
S
Shengliang Guan 已提交
175 176
sql show tags from  st_int_16
if $data05 != NULL then
177 178 179 180 181 182
  return -1
endi
sql select * from st_int_16
if $data01 != NULL then
  return -1
endi
G
Ganlin Zhao 已提交
183

184
sql insert into st_int_17 using mt_int tags (NULL)   values (now, NULL)
S
Shengliang Guan 已提交
185 186
sql show tags from  st_int_17
if $data05 != NULL then
187 188 189 190 191
  return -1
endi
sql select * from st_int_17
if $data01 != NULL then
  return -1
G
Ganlin Zhao 已提交
192
endi
193
sql insert into st_int_18 using mt_int tags ('NULL') values (now, 'NULL')
S
Shengliang Guan 已提交
194 195
sql show tags from  st_int_18
if $data05 != NULL then
196 197 198 199 200 201 202
  return -1
endi
sql select * from st_int_18
if $data01 != NULL then
  return -1
endi
sql insert into st_int_19 using mt_int tags ('NULL') values (now, 'NULL')
S
Shengliang Guan 已提交
203 204
sql show tags from  st_int_19
if $data05 != NULL then
205 206 207 208 209 210 211
  return -1
endi
sql select * from st_int_19
if $data01 != NULL then
  return -1
endi
sql insert into st_int_20 using mt_int tags ("NULL") values (now, "NULL")
S
Shengliang Guan 已提交
212 213
sql show tags from  st_int_20
if $data05 != NULL then
214 215 216 217 218 219 220
  return -1
endi
sql select * from st_int_20
if $data01 != NULL then
  return -1
endi
sql insert into st_int_21 using mt_int tags ("NULL") values (now, "NULL")
S
Shengliang Guan 已提交
221 222
sql show tags from  st_int_21
if $data05 != NULL then
223 224 225 226 227 228 229
  return -1
endi
sql select * from st_int_21
if $data01 != NULL then
  return -1
endi
sql insert into st_int_22 using mt_int tags (2147483647)  values (now, 2147483647)
S
Shengliang Guan 已提交
230 231
sql show tags from  st_int_22
if $data05 != 2147483647 then
232 233 234 235 236
  return -1
endi
sql select * from st_int_22
if $data01 != 2147483647 then
  return -1
G
Ganlin Zhao 已提交
237
endi
238
sql insert into st_int_23 using mt_int tags (-2147483647)  values (now, -2147483647)
S
Shengliang Guan 已提交
239 240
sql show tags from  st_int_23
if $data05 != -2147483647 then
241 242 243 244 245
  return -1
endi
sql select * from st_int_23
if $data01 != -2147483647 then
  return -1
G
Ganlin Zhao 已提交
246
endi
247
sql insert into st_int_24 using mt_int tags (10)    values (now, 10)
S
Shengliang Guan 已提交
248 249
sql show tags from  st_int_24
if $data05 != 10 then
250 251 252 253 254
  return -1
endi
sql select * from st_int_24
if $data01 != 10 then
  return -1
G
Ganlin Zhao 已提交
255
endi
256
sql insert into st_int_25 using mt_int tags ("-0") values (now, "-0")
S
Shengliang Guan 已提交
257 258
sql show tags from  st_int_25
if $data05 != 0 then
259 260 261 262 263
  return -1
endi
sql select * from st_int_25
if $data01 != 0 then
  return -1
G
Ganlin Zhao 已提交
264
endi
265
sql insert into st_int_26 using mt_int tags ('123') values (now, '123')
S
Shengliang Guan 已提交
266 267
sql show tags from  st_int_26
if $data05 != 123 then
268 269 270 271 272
  return -1
endi
sql select * from st_int_26
if $data01 != 123 then
  return -1
G
Ganlin Zhao 已提交
273
endi
274
sql insert into st_int_27 using mt_int tags (+056) values (now, +00056)
S
Shengliang Guan 已提交
275 276
sql show tags from  st_int_27
if $data05 != 56 then
277 278 279 280 281
  return -1
endi
sql select * from st_int_27
if $data01 != 56 then
  return -1
G
Ganlin Zhao 已提交
282
endi
283
sql insert into st_int_28 using mt_int tags (-056) values (now, -0056)
S
Shengliang Guan 已提交
284 285
sql show tags from  st_int_28
if $data05 != -56 then
286 287 288 289 290
  return -1
endi
sql select * from st_int_28
if $data01 != -56 then
  return -1
G
Ganlin Zhao 已提交
291
endi
292 293 294

### case 03: alter tag values
#sql alter table st_int_0 set tag tagname=2147483647
S
Shengliang Guan 已提交
295 296
#sql show tags from  st_int_0
#if $data05 != 2147483647 then
297 298 299
#  return -1
#endi
#sql alter table st_int_0 set tag tagname=-2147483647
S
Shengliang Guan 已提交
300 301
#sql show tags from  st_int_0
#if $data05 != -2147483647 then
302 303 304
#  return -1
#endi
#sql alter table st_int_0 set tag tagname=+100
S
Shengliang Guan 已提交
305 306
#sql show tags from  st_int_0
#if $data05 != 100 then
307 308 309
#  return -1
#endi
#sql alter table st_int_0 set tag tagname=-33
S
Shengliang Guan 已提交
310 311
#sql show tags from  st_int_0
#if $data05 != -33 then
312 313 314
#  return -1
#endi
#sql alter table st_int_0 set tag tagname='+98'
S
Shengliang Guan 已提交
315 316
#sql show tags from  st_int_0
#if $data05 != 98 then
317 318 319
#  return -1
#endi
#sql alter table st_int_0 set tag tagname='-076'
S
Shengliang Guan 已提交
320 321
#sql show tags from  st_int_0
#if $data05 != -76 then
322 323 324
#  return -1
#endi
#sql alter table st_int_0 set tag tagname=+0012
S
Shengliang Guan 已提交
325 326
#sql show tags from  st_int_0
#if $data05 != 12 then
327 328 329
#  return -1
#endi
#sql alter table st_int_0 set tag tagname=-00063
S
Shengliang Guan 已提交
330 331
#sql show tags from  st_int_0
#if $data05 != -63 then
332 333 334 335 336
#  return -1
#endi

## case 04: illegal input
sql_error create table st_int_e0 using mt_int tags (2147483648)
S
Shengliang Guan 已提交
337
sql create table st_int_e0_err1 using mt_int tags (-2147483648)
338 339 340 341
sql_error create table st_int_e0 using mt_int tags (214748364800)
sql_error create table st_int_e0 using mt_int tags (-214748364800)
#sql_error create table st_int_e0 using mt_int tags (12.80)   truncate integer part
#sql_error create table st_int_e0 using mt_int tags (-11.80)
G
Ganlin Zhao 已提交
342
sql_error create table st_int_e0 using mt_int tags (123abc)
343
sql_error create table st_int_e0 using mt_int tags ("123abc")
G
Ganlin Zhao 已提交
344 345 346 347
sql_error create table st_int_e0 using mt_int tags (abc)
sql_error create table st_int_e0 using mt_int tags ("abc")
sql_error create table st_int_e0 using mt_int tags (" ")
sql create table st_int_e0_err2 using mt_int tags ('')
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362

sql create table st_int_e0  using mt_int tags (123)
sql create table st_int_e1  using mt_int tags (123)
sql create table st_int_e2  using mt_int tags (123)
sql create table st_int_e3  using mt_int tags (123)
sql create table st_int_e4  using mt_int tags (123)
sql create table st_int_e5  using mt_int tags (123)
sql create table st_int_e6  using mt_int tags (123)
sql create table st_int_e7  using mt_int tags (123)
sql create table st_int_e8  using mt_int tags (123)
sql create table st_int_e9  using mt_int tags (123)
sql create table st_int_e10 using mt_int tags (123)
sql create table st_int_e11 using mt_int tags (123)
sql create table st_int_e12 using mt_int tags (123)

G
Ganlin Zhao 已提交
363 364 365 366 367 368 369
sql_error insert into st_int_e0  values (now, 2147483648)
sql insert into st_int_e1  values (now, -2147483648)
sql_error insert into st_int_e2  values (now, 3147483648)
sql_error insert into st_int_e3  values (now, -21474836481)
#sql_error insert into st_int_e4  values (now, 12.80)
#sql_error insert into st_int_e5  values (now, -11.80)
sql_error insert into st_int_e6  values (now, 123abc)
370
sql_error insert into st_int_e7  values (now, "123abc")
G
Ganlin Zhao 已提交
371 372 373
sql_error insert into st_int_e9  values (now, abc)
sql_error insert into st_int_e10 values (now, "abc")
sql_error insert into st_int_e11 values (now, " ")
X
Xiaoyu Wang 已提交
374
sql_error insert into st_int_e12 values (now, '')
375

G
Ganlin Zhao 已提交
376 377 378 379 380 381 382
sql_error insert into st_int_e13 using mt_int tags (033) values (now, 2147483648)
sql insert into st_int_e14 using mt_int tags (033) values (now, -2147483648)
sql_error insert into st_int_e15 using mt_int tags (033) values (now, 5147483648)
sql_error insert into st_int_e16 using mt_int tags (033) values (now, -21474836481)
#sql_error insert into st_int_e17 using mt_int tags (033) values (now, 12.80)
#sql_error insert into st_int_e18 using mt_int tags (033) values (now, -11.80)
sql_error insert into st_int_e19 using mt_int tags (033) values (now, 123abc)
383
sql_error insert into st_int_e20 using mt_int tags (033) values (now, "123abc")
G
Ganlin Zhao 已提交
384 385 386
sql_error insert into st_int_e22 using mt_int tags (033) values (now, abc)
sql_error insert into st_int_e23 using mt_int tags (033) values (now, "abc")
sql_error insert into st_int_e24 using mt_int tags (033) values (now, " ")
X
Xiaoyu Wang 已提交
387
sql_error insert into st_int_e25 using mt_int tags (033) values (now, '')
388 389

sql_error insert into st_int_e13 using mt_int tags (2147483648)      values (now, -033)
S
Shengliang Guan 已提交
390
sql insert into st_int_e14_1 using mt_int tags (-2147483648)     values (now, -033)
391 392 393 394 395 396 397 398 399
sql_error insert into st_int_e15 using mt_int tags (21474836480)     values (now, -033)
sql_error insert into st_int_e16 using mt_int tags (-2147483649)    values (now, -033)
#sql_error insert into st_int_e17 using mt_int tags (12.80)    values (now, -033)
#sql_error insert into st_int_e18 using mt_int tags (-11.80)   values (now, -033)
sql_error insert into st_int_e19 using mt_int tags (123abc)   values (now, -033)
sql_error insert into st_int_e20 using mt_int tags ("123abc") values (now, -033)
sql_error insert into st_int_e22 using mt_int tags (abc)      values (now, -033)
sql_error insert into st_int_e23 using mt_int tags ("abc")    values (now, -033)
sql_error insert into st_int_e24 using mt_int tags (" ")      values (now, -033)
S
Shengliang Guan 已提交
400
sql insert into st_int_e25_1 using mt_int tags ('')       values (now, -033)
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415

sql insert into st_int_e13 using mt_int tags (033) values (now, 00062)
sql insert into st_int_e14 using mt_int tags (033) values (now, 00062)
sql insert into st_int_e15 using mt_int tags (033) values (now, 00062)
sql insert into st_int_e16 using mt_int tags (033) values (now, 00062)
sql insert into st_int_e17 using mt_int tags (033) values (now, 00062)
sql insert into st_int_e18 using mt_int tags (033) values (now, 00062)
sql insert into st_int_e19 using mt_int tags (033) values (now, 00062)
sql insert into st_int_e20 using mt_int tags (033) values (now, 00062)
sql insert into st_int_e21 using mt_int tags (033) values (now, 00062)
sql insert into st_int_e22 using mt_int tags (033) values (now, 00062)
sql insert into st_int_e23 using mt_int tags (033) values (now, 00062)
sql insert into st_int_e24 using mt_int tags (033) values (now, 00062)
sql insert into st_int_e25 using mt_int tags (033) values (now, 00062)

G
Ganlin Zhao 已提交
416 417 418
sql_error alter table st_int_e13 set tag tagname=2147483648
sql alter table st_int_e14 set tag tagname=-2147483648
sql_error alter table st_int_e15 set tag tagname=12147483648
419
sql_error alter table st_int_e16 set tag tagname=-3147483648
G
Ganlin Zhao 已提交
420 421 422 423 424 425
sql_error alter table st_int_e19 set tag tagname=123abc
sql_error alter table st_int_e20 set tag tagname="123abc"
sql_error alter table st_int_e22 set tag tagname=abc
sql_error alter table st_int_e23 set tag tagname="abc"
sql_error alter table st_int_e24 set tag tagname=" "
sql alter table st_int_e25 set tag tagname=''
S
Shengliang Guan 已提交
426

G
Ganlin Zhao 已提交
427
system sh/exec.sh -n dnode1 -s stop  -x SIGINT