Fix a crash in unionvtab caused by a misconfiguration. Add other test cases
for the same. FossilOrigin-Name: 255d6b99de2bb210c09ebee9f9481ba3d1130fda47e6e01b4cc8411d00679d09
This commit is contained in:
parent
5a75dd86c1
commit
7f3d20acec
@ -477,8 +477,10 @@ static int unionConnect(
|
||||
if( rc==SQLITE_OK ){
|
||||
pTab->db = db;
|
||||
rc = unionSourceCheck(pTab, pzErr);
|
||||
}
|
||||
|
||||
/* Compose a CREATE TABLE statement and pass it to declare_vtab() */
|
||||
/* Compose a CREATE TABLE statement and pass it to declare_vtab() */
|
||||
if( rc==SQLITE_OK ){
|
||||
pStmt = unionPreparePrintf(&rc, pzErr, db, "SELECT "
|
||||
"'CREATE TABLE xyz('"
|
||||
" || group_concat(quote(name) || ' ' || type, ', ')"
|
||||
|
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\sshell.c.in\sso\sthat\sit\saligns\swith\sshell.c.
|
||||
D 2017-07-18T20:59:40.649
|
||||
C Fix\sa\scrash\sin\sunionvtab\scaused\sby\sa\smisconfiguration.\sAdd\sother\stest\scases\nfor\sthe\ssame.
|
||||
D 2017-07-18T21:19:17.472
|
||||
F Makefile.in d9873c9925917cca9990ee24be17eb9613a668012c85a343aef7e5536ae266e8
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 02b469e9dcd5b7ee63fc1fb05babc174260ee4cfa4e0ef2e48c3c6801567a016
|
||||
@ -281,7 +281,7 @@ F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52
|
||||
F ext/misc/spellfix.c a4723b6aff748a417b5091b68a46443265c40f0d
|
||||
F ext/misc/stmt.c 6f16443abb3551e3f5813bb13ba19a30e7032830015b0f92fe0c0453045c0a11
|
||||
F ext/misc/totype.c 4a167594e791abeed95e0a8db028822b5e8fe512
|
||||
F ext/misc/unionvtab.c e6ed3a3a6fe244c7968620cd74b33a140610541896f69dc28f7168e9dea6326b
|
||||
F ext/misc/unionvtab.c 56fd163d2b6d2f4df0078be482fc9a874658ce51cce33f180c08834193449c78
|
||||
F ext/misc/vfslog.c fe40fab5c077a40477f7e5eba994309ecac6cc95
|
||||
F ext/misc/vfsstat.c bf10ef0bc51e1ad6756629e1edb142f7a8db1178
|
||||
F ext/misc/vtshim.c 1976e6dd68dd0d64508c91a6dfab8e75f8aaf6cd
|
||||
@ -1432,7 +1432,7 @@ F test/tt3_vacuum.c 1753f45917699c9c1f66b64c717a717c9379f776
|
||||
F test/types.test bf816ce73c7dfcfe26b700c19f97ef4050d194ff
|
||||
F test/types2.test 1aeb81976841a91eef292723649b5c4fe3bc3cac
|
||||
F test/types3.test 99e009491a54f4dc02c06bdbc0c5eea56ae3e25a
|
||||
F test/unionvtab.test ba9f8146e847c2386567bc65e43079a8cd9c047ce9f76e034033731efec07989
|
||||
F test/unionvtab.test a5b6a8118de8673aec45cdf8f4aa0bcd05b859e448424558fcbd9ee0f1cc41c2
|
||||
F test/unionvtabfault.test ccb87c510efd0da88d90d813cfaeebe69f2be78cdfbdc3343b04fd9fc507d887
|
||||
F test/unique.test 93f8b2ef5ea51b9495f8d6493429b1fd0f465264
|
||||
F test/unique2.test 3674e9f2a3f1fbbfd4772ac74b7a97090d0f77d2
|
||||
@ -1636,7 +1636,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P deadaad2a0801b3c30d2a076d8eb006b62d8557cff820e0939741c078477c83f
|
||||
R ebeee8c11f6780fb6d8f0948c2e12549
|
||||
U drh
|
||||
Z bc4be0b0821a4d5a78f5a49fc1be3710
|
||||
P 505fdc8ff5150276d3c6ab6135a542b791e9e79e2f76323e592b73b3fdc9bc2a
|
||||
R 8a8c551ade3a7904ad53bd61f1cbe08d
|
||||
U dan
|
||||
Z 3243e7bcd67f989b9bcab9c5c686c467
|
||||
|
@ -1 +1 @@
|
||||
505fdc8ff5150276d3c6ab6135a542b791e9e79e2f76323e592b73b3fdc9bc2a
|
||||
255d6b99de2bb210c09ebee9f9481ba3d1130fda47e6e01b4cc8411d00679d09
|
@ -78,6 +78,19 @@ do_execsql_test 1.7 {
|
||||
20 twenty 21 twenty-one 22 twenty-two
|
||||
}
|
||||
|
||||
do_execsql_test 1.8 {
|
||||
CREATE TABLE src(db, tbl, min, max);
|
||||
INSERT INTO src VALUES(NULL, 't1', 1, 9);
|
||||
INSERT INTO src VALUES('main', 't2', 10, 19);
|
||||
INSERT INTO src VALUES('aux', 't3', 20, 29);
|
||||
CREATE VIRTUAL TABLE temp.opp USING unionvtab(src);
|
||||
SELECT * FROM opp;
|
||||
} {
|
||||
1 one 2 two 3 three
|
||||
10 ten 11 eleven 12 twelve
|
||||
20 twenty 21 twenty-one 22 twenty-two
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Error conditions.
|
||||
#
|
||||
@ -85,6 +98,7 @@ do_execsql_test 1.7 {
|
||||
# 2.2.*: Tables that do not exist.
|
||||
# 2.3.*: Non rowid tables.
|
||||
# 2.4.*: Tables with mismatched schemas.
|
||||
# 2.5.*: A unionvtab table with zero source tables.
|
||||
#
|
||||
do_catchsql_test 2.1.1 {
|
||||
CREATE VIRTUAL TABLE u1 USING unionvtab("VALUES(NULL, 't1', 1, 100)");
|
||||
@ -157,6 +171,25 @@ foreach {tn dbs res} {
|
||||
" $res
|
||||
}
|
||||
|
||||
do_catchsql_test 2.5 {
|
||||
CREATE VIRTUAL TABLE temp.b1 USING unionvtab(
|
||||
[SELECT 'main', 'b1', 0, 100 WHERE 0]
|
||||
)
|
||||
} {1 {no source tables configured}}
|
||||
|
||||
foreach {tn sql} {
|
||||
1 { VALUES('main', 't1', 10, 20), ('main', 't2', 30, 29) }
|
||||
2 { VALUES('main', 't1', 10, 20), ('main', 't2', 15, 30) }
|
||||
} {
|
||||
do_catchsql_test 2.6.$tn "
|
||||
CREATE VIRTUAL TABLE temp.a1 USING unionvtab(`$sql`)
|
||||
" {1 {rowid range mismatch error}}
|
||||
}
|
||||
|
||||
do_catchsql_test 2.7.1 {
|
||||
CREATE VIRTUAL TABLE temp.b1 USING unionvtab(1, 2, 3, 4)
|
||||
} {1 {wrong number of arguments for unionvtab}}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
reset_db
|
||||
|
Loading…
Reference in New Issue
Block a user