Artifact
4659845bc53f809a5932c61c6ce8c5bb9d6b947f:
- File
test/tkt3841.test
— part of check-in
[3d7327fd]
at
2009-06-17 21:42:34
on branch trunk
— Fix a problem in vdbe.c that could cause a double-free of memory if the
SQLITE_LIMIT_LENGTH is changed after a statement is prepared but before
it is run. Also remove debugging statements from tkt3841.test. (CVS 6777)
(user:
drh
size: 1228)
[more...]
0000: 23 20 32 30 30 39 20 4d 61 79 20 37 0a 23 0a 23 # 2009 May 7.#.#
0010: 20 54 68 65 20 61 75 74 68 6f 72 20 64 69 73 63 The author disc
0020: 6c 61 69 6d 73 20 63 6f 70 79 72 69 67 68 74 20 laims copyright
0030: 74 6f 20 74 68 69 73 20 73 6f 75 72 63 65 20 63 to this source c
0040: 6f 64 65 2e 20 20 49 6e 20 70 6c 61 63 65 20 6f ode. In place o
0050: 66 0a 23 20 61 20 6c 65 67 61 6c 20 6e 6f 74 69 f.# a legal noti
0060: 63 65 2c 20 68 65 72 65 20 69 73 20 61 20 62 6c ce, here is a bl
0070: 65 73 73 69 6e 67 3a 0a 23 0a 23 20 20 20 20 4d essing:.#.# M
0080: 61 79 20 79 6f 75 20 64 6f 20 67 6f 6f 64 20 61 ay you do good a
0090: 6e 64 20 6e 6f 74 20 65 76 69 6c 2e 0a 23 20 20 nd not evil..#
00a0: 20 20 4d 61 79 20 79 6f 75 20 66 69 6e 64 20 66 May you find f
00b0: 6f 72 67 69 76 65 6e 65 73 73 20 66 6f 72 20 79 orgiveness for y
00c0: 6f 75 72 73 65 6c 66 20 61 6e 64 20 66 6f 72 67 ourself and forg
00d0: 69 76 65 20 6f 74 68 65 72 73 2e 0a 23 20 20 20 ive others..#
00e0: 20 4d 61 79 20 79 6f 75 20 73 68 61 72 65 20 66 May you share f
00f0: 72 65 65 6c 79 2c 20 6e 65 76 65 72 20 74 61 6b reely, never tak
0100: 69 6e 67 20 6d 6f 72 65 20 74 68 61 6e 20 79 6f ing more than yo
0110: 75 20 67 69 76 65 2e 0a 23 0a 23 2a 2a 2a 2a 2a u give..#.#*****
0120: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0130: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0140: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0150: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0160: 2a 2a 0a 23 0a 23 20 54 69 63 6b 65 74 20 23 33 **.#.# Ticket #3
0170: 38 34 31 0a 23 0a 23 20 54 68 65 20 73 71 6c 69 841.#.# The sqli
0180: 74 65 33 5f 61 67 67 72 65 67 61 74 65 5f 63 6f te3_aggregate_co
0190: 75 6e 74 28 29 20 69 73 20 6e 6f 74 20 62 65 69 unt() is not bei
01a0: 6e 67 20 72 65 73 65 74 20 77 68 65 6e 20 61 6e ng reset when an
01b0: 20 61 67 67 72 65 67 61 74 65 0a 23 20 66 75 6e aggregate.# fun
01c0: 63 74 69 6f 20 69 73 20 75 73 65 64 20 69 6e 20 ctio is used in
01d0: 61 20 63 6f 72 72 65 6c 61 74 65 64 20 73 75 62 a correlated sub
01e0: 71 75 65 72 79 2e 0a 23 0a 73 65 74 20 74 65 73 query..#.set tes
01f0: 74 64 69 72 20 5b 66 69 6c 65 20 64 69 72 6e 61 tdir [file dirna
0200: 6d 65 20 24 61 72 67 76 30 5d 0a 73 6f 75 72 63 me $argv0].sourc
0210: 65 20 24 74 65 73 74 64 69 72 2f 74 65 73 74 65 e $testdir/teste
0220: 72 2e 74 63 6c 0a 0a 69 66 63 61 70 61 62 6c 65 r.tcl..ifcapable
0230: 20 21 73 75 62 71 75 65 72 79 20 7b 0a 20 20 66 !subquery {. f
0240: 69 6e 69 73 68 5f 74 65 73 74 0a 20 20 72 65 74 inish_test. ret
0250: 75 72 6e 0a 7d 0a 0a 64 6f 5f 74 65 73 74 20 74 urn.}..do_test t
0260: 6b 74 33 38 34 31 2e 31 20 7b 0a 20 20 65 78 65 kt3841.1 {. exe
0270: 63 73 71 6c 20 7b 0a 20 20 20 20 43 52 45 41 54 csql {. CREAT
0280: 45 20 54 41 42 4c 45 20 74 61 62 6c 65 32 20 28 E TABLE table2 (
0290: 6b 65 79 20 54 45 58 54 2c 20 78 20 54 45 58 54 key TEXT, x TEXT
02a0: 29 3b 0a 20 20 20 20 43 52 45 41 54 45 20 54 41 );. CREATE TA
02b0: 42 4c 45 20 6c 69 73 74 20 28 6b 65 79 20 54 45 BLE list (key TE
02c0: 58 54 2c 20 76 61 6c 75 65 20 54 45 58 54 29 3b XT, value TEXT);
02d0: 0a 20 20 0a 20 20 20 20 49 4e 53 45 52 54 20 49 . . INSERT I
02e0: 4e 54 4f 20 74 61 62 6c 65 32 20 56 41 4c 55 45 NTO table2 VALUE
02f0: 53 20 28 22 61 22 2c 20 22 61 6c 69 73 74 22 29 S ("a", "alist")
0300: 3b 0a 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 ;. INSERT INT
0310: 4f 20 74 61 62 6c 65 32 20 56 41 4c 55 45 53 20 O table2 VALUES
0320: 28 22 62 22 2c 20 22 62 6c 69 73 74 22 29 3b 0a ("b", "blist");.
0330: 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 INSERT INTO
0340: 6c 69 73 74 20 56 41 4c 55 45 53 20 28 22 61 22 list VALUES ("a"
0350: 2c 20 31 29 3b 0a 20 20 20 20 49 4e 53 45 52 54 , 1);. INSERT
0360: 20 49 4e 54 4f 20 6c 69 73 74 20 56 41 4c 55 45 INTO list VALUE
0370: 53 20 28 22 61 22 2c 20 32 29 3b 0a 20 20 20 20 S ("a", 2);.
0380: 49 4e 53 45 52 54 20 49 4e 54 4f 20 6c 69 73 74 INSERT INTO list
0390: 20 56 41 4c 55 45 53 20 28 22 61 22 2c 20 33 29 VALUES ("a", 3)
03a0: 3b 0a 20 20 20 20 49 4e 53 45 52 54 20 49 4e 54 ;. INSERT INT
03b0: 4f 20 6c 69 73 74 20 56 41 4c 55 45 53 20 28 22 O list VALUES ("
03c0: 62 22 2c 20 34 29 3b 0a 20 20 20 20 49 4e 53 45 b", 4);. INSE
03d0: 52 54 20 49 4e 54 4f 20 6c 69 73 74 20 56 41 4c RT INTO list VAL
03e0: 55 45 53 20 28 22 62 22 2c 20 35 29 3b 0a 20 20 UES ("b", 5);.
03f0: 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 6c 69 INSERT INTO li
0400: 73 74 20 56 41 4c 55 45 53 20 28 22 62 22 2c 20 st VALUES ("b",
0410: 36 29 3b 0a 0a 20 20 20 20 53 45 4c 45 43 54 0a 6);.. SELECT.
0420: 20 20 20 20 20 20 74 61 62 6c 65 32 2e 78 2c 0a table2.x,.
0430: 20 20 20 20 20 20 28 53 45 4c 45 43 54 20 67 72 (SELECT gr
0440: 6f 75 70 5f 63 6f 6e 63 61 74 28 6c 69 73 74 2e oup_concat(list.
0450: 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 46 value). F
0460: 52 4f 4d 20 6c 69 73 74 0a 20 20 20 20 20 20 20 ROM list.
0470: 20 57 48 45 52 45 20 6c 69 73 74 2e 6b 65 79 20 WHERE list.key
0480: 3d 20 74 61 62 6c 65 32 2e 6b 65 79 29 0a 20 20 = table2.key).
0490: 20 20 46 52 4f 4d 20 74 61 62 6c 65 32 3b 0a 20 FROM table2;.
04a0: 20 7d 0a 7d 20 7b 61 6c 69 73 74 20 31 2c 32 2c }.} {alist 1,2,
04b0: 33 20 62 6c 69 73 74 20 34 2c 35 2c 36 7d 0a 0a 3 blist 4,5,6}..
04c0: 66 69 6e 69 73 68 5f 74 65 73 74 0a finish_test.