shane | 468327f | 2008-10-10 13:34:29 +0000 | [diff] [blame] | 1 | # 2008 August 01 |
| 2 | # |
| 3 | # The author disclaims copyright to this source code. In place of |
| 4 | # a legal notice, here is a blessing: |
| 5 | # |
| 6 | # May you do good and not evil. |
| 7 | # May you find forgiveness for yourself and forgive others. |
| 8 | # May you share freely, never taking more than you give. |
| 9 | # |
| 10 | #*********************************************************************** |
| 11 | # |
| 12 | # This test script checks malloc failures in LIMIT operations for |
| 13 | # UPDATE/DELETE statements. |
| 14 | # |
drh | 1c0dc82 | 2008-10-30 22:13:23 +0000 | [diff] [blame^] | 15 | # $Id: mallocJ.test,v 1.2 2008/10/30 22:13:23 drh Exp $ |
shane | 468327f | 2008-10-10 13:34:29 +0000 | [diff] [blame] | 16 | |
| 17 | set testdir [file dirname $argv0] |
| 18 | source $testdir/tester.tcl |
| 19 | source $testdir/malloc_common.tcl |
| 20 | |
| 21 | ifcapable {update_delete_limit} { |
| 22 | |
drh | 1c0dc82 | 2008-10-30 22:13:23 +0000 | [diff] [blame^] | 23 | do_malloc_test mallocJ-1 -sqlprep { |
shane | 468327f | 2008-10-10 13:34:29 +0000 | [diff] [blame] | 24 | DROP TABLE IF EXISTS t1; |
| 25 | CREATE TABLE t1(x int, y int); |
| 26 | INSERT INTO t1 VALUES(1,1); |
| 27 | INSERT INTO t1 VALUES(1,2); |
| 28 | INSERT INTO t1 VALUES(1,2); |
| 29 | INSERT INTO t1 VALUES(2,1); |
| 30 | INSERT INTO t1 VALUES(2,2); |
| 31 | INSERT INTO t1 VALUES(2,3); |
| 32 | } -sqlbody { |
| 33 | UPDATE t1 SET x=1 ORDER BY y LIMIT 2 OFFSET 2; |
| 34 | UPDATE t1 SET x=2 WHERE y=1 ORDER BY y LIMIT 2 OFFSET 2; |
| 35 | DELETE FROM t1 WHERE x=1 ORDER BY y LIMIT 2 OFFSET 2; |
| 36 | DELETE FROM t1 ORDER BY y LIMIT 2 OFFSET 2; |
| 37 | } |
| 38 | |
| 39 | } |
| 40 | |
drh | 1c0dc82 | 2008-10-30 22:13:23 +0000 | [diff] [blame^] | 41 | # ticket #3467 |
| 42 | do_malloc_test mallocJ-2 -sqlprep { |
| 43 | CREATE TABLE t1(a,b); |
| 44 | INSERT INTO t1 VALUES(1,2); |
| 45 | } -sqlbody { |
| 46 | SELECT a, b, 'abc' FROM t1 |
| 47 | UNION |
| 48 | SELECT b, a, 'xyz' FROM t1 |
| 49 | ORDER BY 2, 3; |
| 50 | } |
| 51 | |
shane | 468327f | 2008-10-10 13:34:29 +0000 | [diff] [blame] | 52 | finish_test |