Make sure sufficient VDBE registers are allocated for an INSERT...SELECT

when there is an idlist on the insert table that includes an explicit
rowid.  Ticket [9654505cfda93610585fde5a9bbf2e730c8a8d5]

FossilOrigin-Name: 9a2dd18776cc7003752980be0a0920a8799e5f35
This commit is contained in:
drh 2014-05-23 11:48:57 +00:00
parent 6044f31d13
commit e48ae7157a
4 changed files with 33 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Add\sa\stest\sfor\sthe\sEQP\soutput\sof\sa\sskip-scan\squery\sthat\suses\sthe\sPK\sindex\sof\sa\sWITHOUT\sROWID\stable.
D 2014-05-22T09:58:45.113
C Make\ssure\ssufficient\sVDBE\sregisters\sare\sallocated\sfor\san\sINSERT...SELECT\nwhen\sthere\sis\san\sidlist\son\sthe\sinsert\stable\sthat\sincludes\san\sexplicit\nrowid.\s\sTicket\s[9654505cfda93610585fde5a9bbf2e730c8a8d5]
D 2014-05-23T11:48:57.262
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -182,7 +182,7 @@ F src/global.c 1e4bd956dc2f608f87d2a929abc4a20db65f30e4
F src/hash.c d139319967164f139c8d1bb8a11b14db9c4ba3cd
F src/hash.h 8890a25af81fb85a9ad7790d32eedab4b994da22
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
F src/insert.c ab34bea5af4fee9f956a0805a32463fb7f674d00
F src/insert.c ac1a00ca5952555ad54911666762ee5d59cb63cd
F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
F src/legacy.c 0df0b1550b9cc1f58229644735e317ac89131f12
F src/lempar.c cdf0a000315332fc9b50b62f3b5e22e080a0952b
@ -622,7 +622,7 @@ F test/index7.test a3baf9a625bda7fd49471e99aeae04095fbfeecf
F test/indexedby.test b2f22f3e693a53813aa3f50b812eb609ba6df1ec
F test/indexfault.test 31d4ab9a7d2f6e9616933eb079722362a883eb1d
F test/init.test 15c823093fdabbf7b531fe22cf037134d09587a7
F test/insert.test acf909b067b838eb55338d619e800e148c17f1f5
F test/insert.test 38742b5e9601c8f8d76e9b7555f7270288c2d371
F test/insert2.test 4f3a04d168c728ed5ec2c88842e772606c7ce435
F test/insert3.test 1b7db95a03ad9c5013fdf7d6722b6cd66ee55e30
F test/insert4.test 4791662c50518bdd37d394cae9a7a8014e845bb3
@ -1172,7 +1172,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 34ddf02d3d21151b8099c0c25706530a03d93887
R 2ae64d8090fc3e5fdd65f9927391668c
U dan
Z d9d9ca17c26e25b6a9c95794829b32a1
P 10238fad94a198c0639461645227b6c5ebe16eee
R 8b009b9161335da63146a2b946f50c6a
U drh
Z 94c16efee189e228a9e978b05a24c5a4

View File

@ -1 +1 @@
10238fad94a198c0639461645227b6c5ebe16eee
9a2dd18776cc7003752980be0a0920a8799e5f35

View File

@ -614,6 +614,7 @@ void sqlite3Insert(
if( j>=pTab->nCol ){
if( sqlite3IsRowid(pColumn->a[i].zName) && !withoutRowid ){
ipkColumn = i;
bIdListInOrder = 0;
}else{
sqlite3ErrorMsg(pParse, "table %S has no column named %s",
pTabList, 0, pColumn->a[i].zName);

View File

@ -413,6 +413,29 @@ do_execsql_test insert-11.1 {
} {123456789 '123456789' '123456789'}
# More columns of input than there are columns in the table.
# Ticket http://www.sqlite.org/src/info/e9654505cfda9361
#
do_execsql_test insert-12.1 {
CREATE TABLE t12a(a,b,c,d,e,f,g);
INSERT INTO t12a VALUES(101,102,103,104,105,106,107);
CREATE TABLE t12b(x);
INSERT INTO t12b(x,rowid,x,x,x,x,x) SELECT * FROM t12a;
SELECT rowid, x FROM t12b;
} {102 101}
do_execsql_test insert-12.2 {
CREATE TABLE tab1( value INTEGER);
INSERT INTO tab1 (value, _rowid_) values( 11, 1);
INSERT INTO tab1 (value, _rowid_) SELECT 22,999;
SELECT * FROM tab1;
} {11 22}
do_execsql_test insert-12.3 {
CREATE TABLE t12c(a, b DEFAULT 'xyzzy', c);
INSERT INTO t12c(a, rowid, c) SELECT 'one', 999, 'two';
SELECT * FROM t12c;
} {one xyzzy two}
integrity_check insert-99.0
finish_test