table.sim 9.4 KB
Newer Older
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 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect

print ======== step1 
sql create database d1
sql use d1
sql create table tb (ts timestamp, a int)
sql insert into tb values(now-28d, -28)
sql insert into tb values(now-27d, -27)
sql insert into tb values(now-26d, -26)
sql select * from tb
if $rows != 3 then
  return -1
endi
sql describe tb
if $data00 != ts then
  return -1
endi
if $data01 != TIMESTAMP then
  return -1
endi
if $data10 != a then
  return -1
endi
if $data11 != INT then
  return -1
endi

print ======== step2
sql alter table tb add column b smallint
sql describe tb
if $data00 != ts then
  return -1
endi
if $data01 != TIMESTAMP then
  return -1
endi
if $data10 != a then
  return -1
endi
if $data11 != INT then
  return -1
endi
if $data20 != b then
  return -1
endi
if $data21 != SMALLINT then
  return -1
endi

print ======== step3
sql alter table tb add column c tinyint
sql describe tb
if $data00 != ts then
  return -1
endi
if $data01 != TIMESTAMP then
  return -1
endi
if $data10 != a then
  return -1
endi
if $data11 != INT then
  return -1
endi
if $data20 != b then
  return -1
endi
if $data21 != SMALLINT then
  return -1
endi
if $data30 != c then
  return -1
endi
if $data31 != TINYINT then
  return -1
endi

print ======== step4
sql alter table tb add column d int
sql describe tb
if $data00 != ts then
  return -1
endi
if $data01 != TIMESTAMP then
  return -1
endi
if $data10 != a then
  return -1
endi
if $data11 != INT then
  return -1
endi
if $data20 != b then
  return -1
endi
if $data21 != SMALLINT then
  return -1
endi
if $data30 != c then
  return -1
endi
if $data31 != TINYINT then
  return -1
endi
if $data40 != d then
  return -1
endi
if $data41 != INT then
  return -1
endi

print ======== step5
sql alter table tb add column e bigint
sql describe tb
if $data00 != ts then
  return -1
endi
if $data01 != TIMESTAMP then
  return -1
endi
if $data10 != a then
  return -1
endi
if $data11 != INT then
  return -1
endi
if $data20 != b then
  return -1
endi
if $data21 != SMALLINT then
  return -1
endi
if $data30 != c then
  return -1
endi
if $data31 != TINYINT then
  return -1
endi
if $data40 != d then
  return -1
endi
if $data41 != INT then
  return -1
endi
if $data50 != e then
  return -1
endi
if $data51 != BIGINT then
  return -1
endi

print ======== step6
sql alter table tb add column f float
sql describe tb
if $data00 != ts then
  return -1
endi
if $data01 != TIMESTAMP then
  return -1
endi
if $data10 != a then
  return -1
endi
if $data11 != INT then
  return -1
endi
if $data20 != b then
  return -1
endi
if $data21 != SMALLINT then
  return -1
endi
if $data30 != c then
  return -1
endi
if $data31 != TINYINT then
  return -1
endi
if $data40 != d then
  return -1
endi
if $data41 != INT then
  return -1
endi
if $data50 != e then
  return -1
endi
if $data51 != BIGINT then
  return -1
endi
if $data60 != f then
  return -1
endi
if $data61 != FLOAT then
  return -1
endi

print ======== step7
sql alter table tb add column g double
sql describe tb
if $data00 != ts then
  return -1
endi
if $data01 != TIMESTAMP then
  return -1
endi
if $data10 != a then
  return -1
endi
if $data11 != INT then
  return -1
endi
if $data20 != b then
  return -1
endi
if $data21 != SMALLINT then
  return -1
endi
if $data30 != c then
  return -1
endi
if $data31 != TINYINT then
  return -1
endi
if $data40 != d then
  return -1
endi
if $data41 != INT then
  return -1
endi
if $data50 != e then
  return -1
endi
if $data51 != BIGINT then
  return -1
endi
if $data60 != f then
  return -1
endi
if $data61 != FLOAT then
  return -1
endi
if $data70 != g then
  return -1
endi
if $data71 != DOUBLE then
  return -1
endi

print ======== step8
sql alter table tb add column h binary(10)
S
Shengliang Guan 已提交
255
sql select * from tb
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
sql describe tb
if $data00 != ts then
  return -1
endi
if $data01 != TIMESTAMP then
  return -1
endi
if $data10 != a then
  return -1
endi
if $data11 != INT then
  return -1
endi
if $data20 != b then
  return -1
endi
if $data21 != SMALLINT then
  return -1
endi
if $data30 != c then
  return -1
endi
if $data31 != TINYINT then
  return -1
endi
if $data40 != d then
  return -1
endi
if $data41 != INT then
  return -1
endi
if $data50 != e then
  return -1
endi
if $data51 != BIGINT then
  return -1
endi
if $data60 != f then
  return -1
endi
if $data61 != FLOAT then
  return -1
endi
if $data70 != g then
  return -1
endi
if $data71 != DOUBLE then
  return -1
endi
if $data80 != h then
  return -1
endi
S
Shengliang Guan 已提交
308
if $data81 != VARCHAR then
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372
  return -1
endi
if $data82 != 10 then
  return -1
endi

print ======== step9
print ======== step10
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start

sql use d1
sql describe tb
if $data00 != ts then
  return -1
endi
if $data01 != TIMESTAMP then
  return -1
endi
if $data10 != a then
  return -1
endi
if $data11 != INT then
  return -1
endi
if $data20 != b then
  return -1
endi
if $data21 != SMALLINT then
  return -1
endi
if $data30 != c then
  return -1
endi
if $data31 != TINYINT then
  return -1
endi
if $data40 != d then
  return -1
endi
if $data41 != INT then
  return -1
endi
if $data50 != e then
  return -1
endi
if $data51 != BIGINT then
  return -1
endi
if $data60 != f then
  return -1
endi
if $data61 != FLOAT then
  return -1
endi
if $data70 != g then
  return -1
endi
if $data71 != DOUBLE then
  return -1
endi
if $data80 != h then
  return -1
endi
S
Shengliang Guan 已提交
373
if $data81 != VARCHAR then
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448
  return -1
endi
if $data82 != 10 then
  return -1
endi

print ======== step11
sql alter table drop column a -x step111
  return -1
step111:

sql alter table drop column ts -x step112
  return -1
step112:

sql alter table drop column cdfg -x step113
  return -1
step113:

sql alter table add column a -x step114
  return -1
step114:

sql alter table add column b -x step115
  return -1
step115:

print ======== step12
sql alter table tb drop column b
sql describe tb
if $data00 != ts then
  return -1
endi
if $data01 != TIMESTAMP then
  return -1
endi
if $data10 != a then
  return -1
endi
if $data11 != INT then
  return -1
endi
if $data20 != c then
  return -1
endi
if $data21 != TINYINT then
  return -1
endi
if $data30 != d then
  return -1
endi
if $data31 != INT then
  return -1
endi
if $data40 != e then
  return -1
endi
if $data41 != BIGINT then
  return -1
endi
if $data50 != f then
  return -1
endi
if $data51 != FLOAT then
  return -1
endi
if $data60 != g then
  return -1
endi
if $data61 != DOUBLE then
  return -1
endi
if $data70 != h then
  return -1
endi
S
Shengliang Guan 已提交
449
if $data71 != VARCHAR then
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497
  return -1
endi
if $data72 != 10 then
  return -1
endi

print ======== step13
sql alter table tb drop column c
sql describe tb
if $data00 != ts then
  return -1
endi
if $data01 != TIMESTAMP then
  return -1
endi
if $data10 != a then
  return -1
endi
if $data11 != INT then
  return -1
endi
if $data20 != d then
  return -1
endi
if $data21 != INT then
  return -1
endi
if $data30 != e then
  return -1
endi
if $data31 != BIGINT then
  return -1
endi
if $data40 != f then
  return -1
endi
if $data41 != FLOAT then
  return -1
endi
if $data50 != g then
  return -1
endi
if $data51 != DOUBLE then
  return -1
endi
if $data60 != h then
  return -1
endi
S
Shengliang Guan 已提交
498
if $data61 != VARCHAR then
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540
  return -1
endi
if $data62 != 10 then
  return -1
endi

print ======== step14
sql alter table tb drop column d
sql describe tb
if $data00 != ts then
  return -1
endi
if $data01 != TIMESTAMP then
  return -1
endi
if $data10 != a then
  return -1
endi
if $data11 != INT then
  return -1
endi
if $data20 != e then
  return -1
endi
if $data21 != BIGINT then
  return -1
endi
if $data30 != f then
  return -1
endi
if $data31 != FLOAT then
  return -1
endi
if $data40 != g then
  return -1
endi
if $data41 != DOUBLE then
  return -1
endi
if $data50 != h then
  return -1
endi
S
Shengliang Guan 已提交
541
if $data51 != VARCHAR then
542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577
  return -1
endi
if $data52 != 10 then
  return -1
endi

print ======== step15
sql alter table tb drop column e
sql describe tb
if $data00 != ts then
  return -1
endi
if $data01 != TIMESTAMP then
  return -1
endi
if $data10 != a then
  return -1
endi
if $data11 != INT then
  return -1
endi
if $data20 != f then
  return -1
endi
if $data21 != FLOAT then
  return -1
endi
if $data30 != g then
  return -1
endi
if $data31 != DOUBLE then
  return -1
endi
if $data40 != h then
  return -1
endi
S
Shengliang Guan 已提交
578
if $data41 != VARCHAR then
579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608
  return -1
endi
if $data42 != 10 then
  return -1
endi

print ======== step16
sql alter table tb drop column f
sql describe tb
if $data00 != ts then
  return -1
endi
if $data01 != TIMESTAMP then
  return -1
endi
if $data10 != a then
  return -1
endi
if $data11 != INT then
  return -1
endi
if $data20 != g then
  return -1
endi
if $data21 != DOUBLE then
  return -1
endi
if $data30 != h then
  return -1
endi
S
Shengliang Guan 已提交
609
if $data31 != VARCHAR then
610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633
  return -1
endi
if $data32 != 10 then
  return -1
endi

print ======== step17
sql alter table tb drop column g
sql describe tb
if $data00 != ts then
  return -1
endi
if $data01 != TIMESTAMP then
  return -1
endi
if $data10 != a then
  return -1
endi
if $data11 != INT then
  return -1
endi
if $data20 != h then
  return -1
endi
S
Shengliang Guan 已提交
634
if $data21 != VARCHAR then
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661
  return -1
endi
if $data22 != 10 then
  return -1
endi

print ============= step18
sql alter table tb drop column h
sql describe tb
if $data00 != ts then
  return -1
endi
if $data01 != TIMESTAMP then
  return -1
endi
if $data10 != a then
  return -1
endi
if $data11 != INT then
  return -1
endi
if $data20 != null then
  return -1
endi

print ======= over
sql drop database d1
X
Xiaoyu Wang 已提交
662
sql select * from information_schema.ins_databases
663
if $rows != 2 then
664 665 666
  return -1
endi

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