Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | A few more tests for upsert. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
b78005b6d41640203c163ffde4faf933 |
User & Date: | dan 2018-04-21 14:11:18.088 |
Context
2018-04-21
| ||
20:24 | Enhance LEMON to track which symbols actually carry semantic content. Output the list of symbols that do not carry content at the end of the report, but do not (yet) do anything else with the information. (check-in: dcf2bafc15 user: drh tags: trunk) | |
14:11 | A few more tests for upsert. (check-in: b78005b6d4 user: dan tags: trunk) | |
13:51 | Add the %extra_context directive to lemon, as an alternative to %extra_argument. Use this to improve the performance of the parser. (check-in: be47a6f526 user: drh tags: trunk) | |
Changes
Changes to test/upsert4.test.
︙ | ︙ | |||
327 328 329 330 331 332 333 | DO UPDATE SET w = w||tbl.w; SELECT * FROM t1; } {c 1 1 1 bbbbbbbb 2 2 2} } foreach {tn sql} { 1 { | | > > | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | DO UPDATE SET w = w||tbl.w; SELECT * FROM t1; } {c 1 1 1 bbbbbbbb 2 2 2} } foreach {tn sql} { 1 { CREATE TABLE excluded(w, x INTEGER, 'a b', z, PRIMARY KEY(x, 'a b')); CREATE UNIQUE INDEX zz ON excluded(z); CREATE INDEX zz2 ON excluded(z); } 2 { CREATE TABLE excluded(w, x, 'a b', z, PRIMARY KEY(x, 'a b')) WITHOUT ROWID; CREATE UNIQUE INDEX zz ON excluded(z); CREATE INDEX zz2 ON excluded(z); } } { reset_db execsql $sql do_execsql_test 8.$tn.0 { INSERT INTO excluded VALUES('a', 1, 1, 1); INSERT INTO excluded VALUES('b', 2, 2, 2); |
︙ | ︙ | |||
355 356 357 358 359 360 361 | } {a 1 1 1 b 2 2 2} do_execsql_test 8.$tn.2 { INSERT INTO excluded AS x1 VALUES('hello', 1, 1, NULL) ON CONFLICT(x, [a b]) DO UPDATE SET w=excluded.w; SELECT * FROM excluded; } {hello 1 1 1 b 2 2 2} | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | } {a 1 1 1 b 2 2 2} do_execsql_test 8.$tn.2 { INSERT INTO excluded AS x1 VALUES('hello', 1, 1, NULL) ON CONFLICT(x, [a b]) DO UPDATE SET w=excluded.w; SELECT * FROM excluded; } {hello 1 1 1 b 2 2 2} do_execsql_test 8.$tn.3 { INSERT INTO excluded AS x1 VALUES('hello', 1, 1, NULL) ON CONFLICT(x, [a b]) DO UPDATE SET w=w||w WHERE excluded.w!='hello'; SELECT * FROM excluded; } {hello 1 1 1 b 2 2 2} do_execsql_test 8.$tn.4 { INSERT INTO excluded AS x1 VALUES('hello', 1, 1, NULL) ON CONFLICT(x, [a b]) DO UPDATE SET w=w||w WHERE excluded.x=1; SELECT * FROM excluded; } {hellohello 1 1 1 b 2 2 2} do_catchsql_test 8.$tn.5 { INSERT INTO excluded AS x1 VALUES('hello', 1, 1, NULL) ON CONFLICT(x, [a b]) WHERE y=1 DO UPDATE SET w=w||w WHERE excluded.x=1; } {1 {no such column: y}} } #-------------------------------------------------------------------------- # do_execsql_test 9.0 { CREATE TABLE v(x INTEGER); CREATE TABLE hist(x INTEGER PRIMARY KEY, cnt INTEGER); CREATE TRIGGER vt AFTER INSERT ON v BEGIN INSERT INTO hist VALUES(new.x, 1) ON CONFLICT(x) DO UPDATE SET cnt=cnt+1; END; } do_execsql_test 9.1 { INSERT INTO v VALUES(1), (4), (1), (5), (5), (8), (9), (1); SELECT * FROM hist; } { 1 3 4 1 5 2 8 1 9 1 } finish_test |
Added test/upsertfault.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # 2018-04-17 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # # Test cases for UPSERT set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix upsertfault do_execsql_test 1.0 { CREATE TABLE t1(a PRIMARY KEY, b, c, d, UNIQUE(b, c)); INSERT INTO t1 VALUES(1, 1, 1, 1); INSERT INTO t1 VALUES(2, 2, 2, 2); } faultsim_save_and_close do_faultsim_test 1 -faults oom* -prep { faultsim_restore_and_reopen db eval { SELECT * FROM sqlite_master } } -body { execsql { INSERT INTO t1 VALUES(3, 2, 2, NULL) ON CONFLICT(b, c) DO UPDATE SET d=d+1; } } -test { faultsim_test_result {0 {}} } finish_test |