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 255 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 308 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 373 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 449 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 498 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 541 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 578 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 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 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 662 663 664 665 666 667 668 669 670 671 672 673
|
ij> --
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may not use this file except in compliance with
-- the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
-- Test partial row access for update and delete
--
maximumdisplaywidth 2000;
ij> drop function getScanCols;
ERROR 42Y55: 'DROP FUNCTION' cannot be performed on 'GETSCANCOLS' because it does not exist.
ij> drop table basic;
ERROR 42Y55: 'DROP TABLE' cannot be performed on 'BASIC' because it does not exist.
ij> drop table p;
ERROR 42Y55: 'DROP TABLE' cannot be performed on 'P' because it does not exist.
ij> CREATE FUNCTION getScanCols(value VARCHAR(32672))
RETURNS VARCHAR (32672) EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.StatParser.getScanCols'
LANGUAGE JAVA PARAMETER STYLE JAVA NO SQL;
0 rows inserted/updated/deleted
ij> create table p (ccharForBitData char(1) for bit data not null, cdec dec(6,2) not null, unindexed smallint, cchar char(10) not null,
constraint pk1 primary key (cchar, ccharForBitData), constraint pk2 unique (cdec));
0 rows inserted/updated/deleted
ij> insert into p values (x'00', 0.0, 11, '00');
1 row inserted/updated/deleted
ij> insert into p values (x'11', 1.1, 22, '11');
1 row inserted/updated/deleted
ij> insert into p values (x'22', 2.2, 33, '22');
1 row inserted/updated/deleted
ij> insert into p values (x'33', 3.3, 44, '33');
1 row inserted/updated/deleted
ij> create table basic (cint int, cchar char(10),
ctime time, cdec dec(6,2),
ccharForBitData char(1) for bit data, unindexed int);
0 rows inserted/updated/deleted
ij> create index b1 on basic (cchar, ccharForBitData, cint);
0 rows inserted/updated/deleted
ij> create index b2 on basic (ctime);
0 rows inserted/updated/deleted
ij> create index b3 on basic (ctime, cint);
0 rows inserted/updated/deleted
ij> create index b4 on basic (cint);
0 rows inserted/updated/deleted
ij> maximumdisplaywidth 200;
ij> call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1);
0 rows inserted/updated/deleted
ij> -- the extra 33s are so we can ensure we'll use an index when looking for the others
insert into basic values (11, '11', TIME('11:11:11'), 1.1, x'11', 11);
1 row inserted/updated/deleted
ij> insert into basic values (22, '22', TIME('22:22:22'), 2.2, x'22', 22);
1 row inserted/updated/deleted
ij> insert into basic values (33, '33', TIME('03:33:33'), 3.3, x'33', 33);
1 row inserted/updated/deleted
ij> insert into basic values (33, '33', TIME('03:33:33'), 3.3, x'33', 33);
1 row inserted/updated/deleted
ij> insert into basic values (33, '33', TIME('03:33:33'), 3.3, x'33', 33);
1 row inserted/updated/deleted
ij> insert into basic values (33, '33', TIME('03:33:33'), 3.3, x'33', 33);
1 row inserted/updated/deleted
ij> insert into basic values (33, '33', TIME('03:33:33'), 3.3, x'33', 33);
1 row inserted/updated/deleted
ij> insert into basic values (33, '33', TIME('03:33:33'), 3.3, x'33', 33);
1 row inserted/updated/deleted
ij> insert into basic values (33, '33', TIME('03:33:33'), 3.3, x'33', 33);
1 row inserted/updated/deleted
ij> insert into basic values (33, '33', TIME('03:33:33'), 3.3, x'33', 33);
1 row inserted/updated/deleted
ij> insert into basic values (33, '33', TIME('03:33:33'), 3.3, x'33', 33);
1 row inserted/updated/deleted
ij> insert into basic values (33, '33', TIME('03:33:33'), 3.3, x'33', 33);
1 row inserted/updated/deleted
ij> -- simple update of each column
update basic set cint = cint;
12 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={0, 1, 2, 4}
ij> update basic set cchar = cchar;
12 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B1 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched={0, 1, 2, 3}
ij> update basic set ctime = ctime;
12 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B3 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched={0, 1, 2}
ij> update basic set cdec = cdec;
12 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={3}
ij> update basic set ccharForBitData = ccharForBitData;
12 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B1 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched={0, 1, 2, 3}
ij> update basic set unindexed = unindexed;
12 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={5}
ij> -- confirm the table is ok
select ccharForBitData, ctime, cdec, cint, cchar from basic;
CCH&|CTIME |CDEC |CINT |CCHAR
---------------------------------------------
11 |11:11:11|1.10 |11 |11
22 |22:22:22|2.20 |22 |22
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
ij> values (SYSCS_UTIL.SYSCS_CHECK_TABLE('APP', 'BASIC'));
1
-----------
1
ij> update basic set cint = cint where cint = 11;
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B4 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched=All
ij> update basic set cchar = cchar where cint = 11;
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B4 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched=All
ij> update basic set ctime = ctime where cint = 11;
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B4 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched=All
ij> update basic set ctime = ctime where cint = 11;
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B4 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched=All
ij> update basic set cdec = cdec where cint = 11;
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B4 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched=All
ij> update basic set ccharForBitData = ccharForBitData where cint = 11;
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B4 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched=All
ij> -- confirm the table is ok
select ccharForBitData, ctime, cdec, cint, cchar from basic;
CCH&|CTIME |CDEC |CINT |CCHAR
---------------------------------------------
11 |11:11:11|1.10 |11 |11
22 |22:22:22|2.20 |22 |22
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
ij> values (SYSCS_UTIL.SYSCS_CHECK_TABLE('APP', 'BASIC'));
1
-----------
1
ij> update basic set cint = cint where ccharForBitData = x'11';
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={0, 1, 2, 4}
ij> update basic set cchar = cchar where ccharForBitData = x'11';
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B1 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched={0, 1, 2, 3}
ij> update basic set ctime = ctime where ccharForBitData = x'11';
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={0, 2, 4}
ij> update basic set cdec = cdec where ccharForBitData = x'11';
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={3, 4}
ij> update basic set ccharForBitData = ccharForBitData where ccharForBitData = x'11';
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B1 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched={0, 1, 2, 3}
ij> -- confirm the table is ok
select ccharForBitData, ctime, cdec, cint, cchar from basic;
CCH&|CTIME |CDEC |CINT |CCHAR
---------------------------------------------
11 |11:11:11|1.10 |11 |11
22 |22:22:22|2.20 |22 |22
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
ij> values (SYSCS_UTIL.SYSCS_CHECK_TABLE('APP', 'BASIC'));
1
-----------
1
ij> autocommit off;
ij> update basic set cdec = cint;
12 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={0, 3}
ij> -- confirm the table is ok
select ccharForBitData, ctime, cdec, cint, cchar from basic;
CCH&|CTIME |CDEC |CINT |CCHAR
---------------------------------------------
11 |11:11:11|11.00 |11 |11
22 |22:22:22|22.00 |22 |22
33 |03:33:33|33.00 |33 |33
33 |03:33:33|33.00 |33 |33
33 |03:33:33|33.00 |33 |33
33 |03:33:33|33.00 |33 |33
33 |03:33:33|33.00 |33 |33
33 |03:33:33|33.00 |33 |33
33 |03:33:33|33.00 |33 |33
33 |03:33:33|33.00 |33 |33
33 |03:33:33|33.00 |33 |33
33 |03:33:33|33.00 |33 |33
ij> values (SYSCS_UTIL.SYSCS_CHECK_TABLE('APP', 'BASIC'));
1
-----------
1
ij> rollback;
ij> update basic set cchar = cchar where cdec = 3.3 and ctime = TIME('03:33:33');
10 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={0, 1, 2, 3, 4}
ij> update basic set ctime = ctime, cchar = cchar, cint = cint, cdec = cdec, ccharForBitData = ccharForBitData;
12 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={0, 1, 2, 3, 4}
ij> -- confirm the table is ok
select ccharForBitData, ctime, cdec, cint, cchar from basic;
CCH&|CTIME |CDEC |CINT |CCHAR
---------------------------------------------
11 |11:11:11|1.10 |11 |11
22 |22:22:22|2.20 |22 |22
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
33 |03:33:33|3.30 |33 |33
ij> values (SYSCS_UTIL.SYSCS_CHECK_TABLE('APP', 'BASIC'));
1
-----------
1
ij> --------------------------------------------------------------------------
-- deletes
--------------------------------------------------------------------------
--
-- index scans
--
delete from basic where cchar = '22';
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B1 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched=All
ij> rollback;
ij> delete from basic where cint = 22;
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B4 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched=All
ij> rollback;
ij> delete from basic where ctime = TIME('22:22:22');
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B2 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched=All
ij> rollback;
ij> delete from basic where ccharForBitData = x'22';
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={0, 1, 2, 4}
ij> rollback;
ij> delete from basic where cdec = 2.2;
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={0, 1, 2, 3, 4}
ij> rollback;
ij> --
-- index row to base row
--
delete from basic where cchar = '22' and unindexed = 22;
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B1 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched=All
ij> rollback;
ij> delete from basic where cint = 22 and unindexed = 22;
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B4 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched=All
ij> rollback;
ij> delete from basic where ctime = TIME('22:22:22') and unindexed = 22;
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B2 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched=All
ij> rollback;
ij> delete from basic where ccharForBitData = x'22' and unindexed = 22;
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={0, 1, 2, 4, 5}
ij> rollback;
ij> delete from basic where cdec = 2.2 and unindexed = 22;
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched=All
ij> rollback;
ij> --
-- table scans
--
delete from basic where cchar > '00';
12 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={0, 1, 2, 4}
ij> rollback;
ij> delete from basic where cint > 1;
12 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={0, 1, 2, 4}
ij> rollback;
ij> delete from basic where ctime > TIME('00:00:01');
12 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={0, 1, 2, 4}
ij> rollback;
ij> delete from basic where ccharForBitData > x'11';
11 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={0, 1, 2, 4}
ij> rollback;
ij> delete from basic where cdec > 2;
11 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={0, 1, 2, 3, 4}
ij> rollback;
ij> delete from basic where unindexed = 22;
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={0, 1, 2, 4, 5}
ij> rollback;
ij> --
-- some checks on deferred deletes
--
delete from basic where unindexed = (select min(cint) from basic);
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B1 at read committed isolation level using instantaneous share row locking chosen by the optimizer
Bit set of columns fetched={2}
Bit set of columns fetched&
ij> rollback;
ij> delete from basic where cint = (select min(cint) from basic);
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B1 at read committed isolation level using instantaneous share row locking chosen by the optimizer
Bit set of columns fetched={2}
Bit set of columns fetched&
ij> rollback;
ij> delete from basic where cdec = (select min(cdec) from basic);
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={3}
Bit set of columns fetched={0, 1, 2, 3, 4}
ij> rollback;
ij> delete from basic where cdec = 1.1 and cchar = (select min(cchar) from basic);
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B1 at read committed isolation level using share row locking chosen by the optimizer
Bit set of columns fetched={0}
Bit set of columns fetched=All
ij> rollback;
ij> --
-- quickly confirm that we get all columns for updateable cursors
--
get cursor c as 'select cint from basic for update';
ij> next c;
CINT
-----------
11
ij> -----------------------------------------------------------------
-- now lets try some constraints
-----------------------------------------------------------------
--
-- check constraints
--
alter table basic add constraint ck check (unindexed > cdec);
ERROR X0X95: Operation 'ALTER TABLE' cannot be performed on object 'BASIC' because there is an open ResultSet dependent on that object.
ij> commit;
ij> update basic set unindexed = unindexed where cint = 11;
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B4 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched=All
ij> rollback;
ij> update basic set unindexed = unindexed;
12 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={5}
ij> rollback;
ij> update basic set cdec = cdec where cint = 11;
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B4 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched=All
ij> rollback;
ij> delete from basic where cint = 11;
1 row inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B4 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched=All
ij> rollback;
ij> -- one that isn't affected by contstraint
update basic set ctime = ctime;
12 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B3 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched={0, 1, 2}
ij> rollback;
ij> -- confirm it is working ok
update basic set unindexed = 0;
12 rows inserted/updated/deleted
ij> rollback;
ij> --
-- foreign keys
--
alter table basic add constraint fk1 foreign key (cchar, ccharForBitData) references p;
0 rows inserted/updated/deleted
ij> commit;
ij> update basic set cchar = cchar, ccharForBitData = ccharForBitData;
12 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B1 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched={0, 1, 2, 3}
ij> update basic set cchar = cchar;
12 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B1 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched={0, 1, 2, 3}
ij> update basic set ccharForBitData = ccharForBitData;
12 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for BASIC using index B1 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched={0, 1, 2, 3}
ij> rollback;
ij> --pk update
-- only this update should fail, does not satisfy fk1
update p set ccharForBitData = x'22', cchar = CAST(unindexed as CHAR(10));
ERROR 23503: UPDATE on table 'P' caused a violation of foreign key constraint 'FK1' for key (11 ,11). The statement has been rolled back.
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={0, 2, 3}
ij> rollback;
ij> update p set cdec = cdec + 1.1;
4 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for P using constraint PK2 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched={0, 1}
ij> rollback;
ij> update p set unindexed = 666, cchar = 'fail';
ERROR 23503: UPDATE on table 'P' caused a violation of foreign key constraint 'FK1' for key (11 ,11). The statement has been rolled back.
ij> rollback;
ij> -- only this update should fail, does not satisfy fk1
update p set ccharForBitData = x'66' where ccharForBitData = x'22';
ERROR 23503: UPDATE on table 'P' caused a violation of foreign key constraint 'FK1' for key (22 ,22). The statement has been rolled back.
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for P using constraint PK1 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched={0, 1, 2}
ij> rollback;
ij> alter table basic add constraint fk2 foreign key (cdec) references p(cdec);
0 rows inserted/updated/deleted
ij> commit;
ij> update p set cdec = cdec + 1.1;
4 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan ResultSet for P using constraint PK2 at read committed isolation level using exclusive row locking chosen by the optimizer
Bit set of columns fetched={0, 1}
ij> rollback;
ij> update basic set cdec = cdec, cint = cint, ccharForBitData = ccharForBitData, cchar = cchar;
12 rows inserted/updated/deleted
ij> values getScanCols(SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS());
1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TableScan
Bit set of columns fetched={0, 1, 2, 3, 4}
ij> rollback;
ij> update basic set cdec = cdec+1.1, cint = cint, ccharForBitData = ccharForBitData, cchar = cchar;
ERROR 23503: UPDATE on table 'BASIC' caused a violation of foreign key constraint 'FK2' for key (4.40). The statement has been rolled back.
ij> rollback;
ij> delete from p where cdec = 1.1;
ERROR 23503: DELETE on table 'P' caused a violation of foreign key constraint 'FK1' for key (11 ,11). The statement has been rolled back.
ij> rollback;
ij> -- clean up
drop function getScanCols;
0 rows inserted/updated/deleted
ij> drop table basic;
0 rows inserted/updated/deleted
ij> drop table p;
0 rows inserted/updated/deleted
ij>
|