Back out the recent change to carray. The intent is to fix this problem

in a different way so that it works for all table-valued functions.

FossilOrigin-Name: 43e02dbb0dbe7192304125cd3298b3f4bbac02395d4d03f7f8d5f96b465eb43e
This commit is contained in:
drh
2026-06-01 12:07:21 +00:00
parent 3040da55a8
commit f3eea1efa4
6 changed files with 45 additions and 47 deletions
+13 -10
View File
@@ -1,5 +1,5 @@
C Fix\san\sinteger\soverflow\sthat\scould\slead\sto\sa\sbuffer\soverrun\sin\sthe\szipfile\sextension.\sBug\s[bugs:/info/2026-06-01T10:16:47Z\s|\s2026-06-01T10:16:47Z].
D 2026-06-01T11:52:23.115
C Back\sout\sthe\srecent\schange\sto\scarray.\s\sThe\sintent\sis\sto\sfix\sthis\sproblem\nin\sa\sdifferent\sway\sso\sthat\sit\sworks\sfor\sall\stable-valued\sfunctions.
D 2026-06-01T12:07:21.662
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -682,7 +682,7 @@ F src/btree.h e823c46d87f63d904d735a24b76146d19f51f04445ea561f71cc3382fd1307f0
F src/btreeInt.h 9c0f9ea5c9b5f4dcaea18111d43efe95f2ac276cd86d770dce10fd99ccc93886
F src/build.c 866e584cdf40fbc83f530af9fd4d0991582a6fdbd8a9911b7cdbbea5f26a4a9e
F src/callback.c 3605bbf02bd7ed46c79cd48346db4a32fc51d67624400539c0532f4eead804ad
F src/carray.c 980bd544ec715b0f3b3143fa3cb1096440ed02ddf5c0b72c2b68d239a5734ccd
F src/carray.c 3efe3982d5fb323334c29328a4e189ccaef6b95612a6084ad5fa124fd5db1179
F src/complete.c f216b970ce99c5a657556cf1f17e7ddd494515d3beb63df426bf59ff43bd3d9a
F src/date.c 61e92f1f7e2e88e1cd91e91dc69eb2b2854e7877254470f9fabd776bfac922b8
F src/dbpage.c c6a9de13b0a01f0bc94a41e16213ab1ecd15ccfe86df7255ced40fda9446257d
@@ -958,8 +958,8 @@ F test/capi3b.test efb2b9cfd127efa84433cd7a2d72ce0454ae0dc4
F test/capi3c.test 31d3a6778f2d06f2d9222bd7660c41a516d1518a059b069e96ebbeadb5a490f7
F test/capi3d.test 8b778794af891b0dca3d900bd345fbc8ebd2aa2aae425a9dccdd10d5233dfbde
F test/capi3e.test 3d49c01ef2a1a55f41d73cba2b23b5059ec460fe
F test/carray01.test b21e62c974267bd17cf0e23674aaa55e694097ea3ca5ff9888a9e790cc89d3fa
F test/carray02.test 68b23ee1724313ffa80e655cdb20b75dd4bee763fd7a9d5fefc0627f6efad2b2
F test/carray01.test 17c1cf8287862b15dda949dba626fd5fee5c58471dcc1cae0341471c2ae7da01
F test/carray02.test 9d070b54f24a34d1f3b3c552ba34db0375a9d1c4219067416fb07d1595987c9d
F test/carrayfault.test 108a7d83904fc267c448e27c13b2a857c700bd6ddaa2f1e2518be718b159cb6b
F test/cast.test a2a3b32df86e3c0601ffa2e9f028a18796305d251801efea807092dbf374a040
F test/cffault.test 9d6b20606afe712374952eec4f8fd74b1a8097ef
@@ -2207,9 +2207,12 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
P 2b073519b6080abc8872b0728c64827cc088d1b43f132cd2aeb396f06de3d36f cc86820e198db6ee4e62f455d3dd9877d73873aaccad6ceffd0b34452d35c89c
R 6fc3e7ce84a5a456338015adf8a6b339
T +closed cc86820e198db6ee4e62f455d3dd9877d73873aaccad6ceffd0b34452d35c89c
U dan
Z debaee7cc6e028d3c510d9935b697d9d
P a8dac6af353c02aed8eaaba5921e036d3f3a6639367ae70e8c75d759c7b4ab52
Q -3c0a277e6741c72281e12c44d85902aa6780890a7f59bacc3ac2b35ba27f7211
R f18e0b69c03d4dfa250325f78c741c04
T *branch * right-ref-cte
T *sym-right-ref-cte *
T -sym-trunk *
U drh
Z 55f4eb42a0a1934257d59044d7e23ac1
# Remove this line to create a well-formed Fossil manifest.
+2 -2
View File
@@ -1,2 +1,2 @@
branch trunk
tag trunk
branch right-ref-cte
tag right-ref-cte
+1 -1
View File
@@ -1 +1 @@
a8dac6af353c02aed8eaaba5921e036d3f3a6639367ae70e8c75d759c7b4ab52
43e02dbb0dbe7192304125cd3298b3f4bbac02395d4d03f7f8d5f96b465eb43e
+27 -20
View File
@@ -258,31 +258,36 @@ static int carrayFilter(
carray_cursor *pCur = (carray_cursor *)pVtabCursor;
pCur->pPtr = 0;
pCur->iCnt = 0;
if( idxNum==1 ){
carray_bind *pBind = sqlite3_value_pointer(argv[0], "carray-bind");
if( pBind ){
switch( idxNum ){
case 1: {
carray_bind *pBind = sqlite3_value_pointer(argv[0], "carray-bind");
if( pBind==0 ) break;
pCur->pPtr = pBind->aData;
pCur->iCnt = pBind->nData;
pCur->eType = pBind->mFlags & 0x07;
break;
}
}else if( ALWAYS(idxNum==2 || idxNum==3) ){
pCur->pPtr = sqlite3_value_pointer(argv[0], "carray");
pCur->iCnt = pCur->pPtr ? sqlite3_value_int64(argv[1]) : 0;
if( idxNum<3 ){
pCur->eType = CARRAY_INT32;
}else{
unsigned char i;
const char *zType = (const char*)sqlite3_value_text(argv[2]);
for(i=0; i<sizeof(azCarrayType)/sizeof(azCarrayType[0]); i++){
if( sqlite3_stricmp(zType, azCarrayType[i])==0 ) break;
}
if( i>=sizeof(azCarrayType)/sizeof(azCarrayType[0]) ){
pVtabCursor->pVtab->zErrMsg = sqlite3_mprintf(
"unknown datatype: %Q", zType);
return SQLITE_ERROR;
case 2:
case 3: {
pCur->pPtr = sqlite3_value_pointer(argv[0], "carray");
pCur->iCnt = pCur->pPtr ? sqlite3_value_int64(argv[1]) : 0;
if( idxNum<3 ){
pCur->eType = CARRAY_INT32;
}else{
pCur->eType = i;
unsigned char i;
const char *zType = (const char*)sqlite3_value_text(argv[2]);
for(i=0; i<sizeof(azCarrayType)/sizeof(azCarrayType[0]); i++){
if( sqlite3_stricmp(zType, azCarrayType[i])==0 ) break;
}
if( i>=sizeof(azCarrayType)/sizeof(azCarrayType[0]) ){
pVtabCursor->pVtab->zErrMsg = sqlite3_mprintf(
"unknown datatype: %Q", zType);
return SQLITE_ERROR;
}else{
pCur->eType = i;
}
}
break;
}
}
pCur->iRowid = 1;
@@ -362,7 +367,9 @@ static int carrayBestIndex(
return SQLITE_CONSTRAINT;
}
}else{
return SQLITE_CONSTRAINT;
pIdxInfo->estimatedCost = (double)2147483647;
pIdxInfo->estimatedRows = 2147483647;
pIdxInfo->idxNum = 0;
}
return SQLITE_OK;
}
-12
View File
@@ -164,16 +164,4 @@ do_test 300 {
sqlite3_finalize $STMT
sqlite3_finalize $STMT2
# 2026-05-31 dbsqlfuzz case 55c60cf7eb9e0f14c811b7c9227b8d2a0c32f022
do_catchsql_test 400 {
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT PRIMARY KEY, b INT) WITHOUT ROWID;
WITH c(x) AS (
VALUES(1)
UNION
SELECT x+1 FROM (carray NATURAL FULL JOIN carray(t1.b)), t1, c
)
SELECT * FROM c;
} {1 {no query solution}}
finish_test
+2 -2
View File
@@ -135,9 +135,9 @@ foreach {tn sql res} {
# Test that not binding any pointer, or passing a value that is not a bound
# pointer to carray() produces no rows of output.
#
do_catchsql_test 3.0.0 {
do_execsql_test 3.0.0 {
SELECT * FROM carray
} {1 {no query solution}}
} {}
do_execsql_test 3.0.1 {
SELECT * FROM carray('0xFFFF', 5)
} {}