Fix a faulty assert() in walker.c that could fail when processing an ALTER TABLE statement on a schema containing invalid table references that are part of a WINDOW definition.

FossilOrigin-Name: ee076c28d8ee0f5b099cdef83ae6cea6ef5aa209ab528d7c49949dd653ce019c
This commit is contained in:
dan 2019-07-19 10:31:29 +00:00
parent b555b0806e
commit a1ac03590b
4 changed files with 46 additions and 10 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\snew\sproblem\sin\sthe\sBETWEEN\soperator\swhen\sapplied\sto\sa\swindow\sfunction.\nThe\sproblem\swas\sintroduced\syesterday\sby\scheck-in\s[7ef7b23cbb1b9ace].
D 2019-07-19T01:11:27.778
C Fix\sa\sfaulty\sassert()\sin\swalker.c\sthat\scould\sfail\swhen\sprocessing\san\sALTER\sTABLE\sstatement\son\sa\sschema\scontaining\sinvalid\stable\sreferences\sthat\sare\spart\sof\sa\sWINDOW\sdefinition.
D 2019-07-19T10:31:29.400
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -607,7 +607,7 @@ F src/vtab.c 1fa256c6ddad7a81e2a4dc080d015d4b0a7135767717d311298e47f6fca64bb3
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c bbd6838bd79c0a32144d482fb0b6a9d2d1a252fb3b16d5005ec30f2f80413b0d
F src/wal.h 606292549f5a7be50b6227bd685fa76e3a4affad71bb8ac5ce4cb5c79f6a176a
F src/walker.c ccbe57a6eeedce5826510c509cebb547e0c877d53f14b3118698643057d4b597
F src/walker.c 8fb08ed58d7dc8fc144ca6eab82bcb2e0f20b9824dc4279dd7a1fe75951dc2bc
F src/where.c 2f508c9a6dd2a42ad2b692105e77eb92cdec201d32916962ccdeff71836acb52
F src/whereInt.h 1b728f71654ebf8421a1715497a587f02d6f538e819af58dc826908f8577e810
F src/wherecode.c 37a1004237d630d785c47bba2290eac652a7a8b0047518eba3cb7c808b604c4a
@ -632,7 +632,7 @@ F test/altermalloc.test 167a47de41b5c638f5f5c6efb59784002b196fff70f98d9b4ed3cd74
F test/altermalloc2.test fa7b1c1139ea39b8dec407cf1feb032ca8e0076bd429574969b619175ad0174b
F test/altertab.test b6901287474841cffbd8f90b098d3bd7d8445868b42caeb01b27034698f7245f
F test/altertab2.test 8883693952f6d7fb5f754dbf1d694ed780aa883027bef04cb1fb99a3b88c9272
F test/altertab3.test 7a2419829b2b908985b2c83d680388ef2eb9a74e446b68cee7b9b1551ae69078
F test/altertab3.test 4f9dbe767c0f8892d0026b89f7b645b2b2fcd64d4940d9323fbd187955280637
F test/amatch1.test b5ae7065f042b7f4c1c922933f4700add50cdb9f
F test/analyze.test 7168c8bffa5d5cbc53c05b7e9c7fcdd24b365a1bc5046ce80c45efa3c02e6b7c
F test/analyze3.test ff62d9029e6deb2c914490c6b00caf7fae47cc85cdc046e4a0d0a4d4b87c71d8
@ -1837,7 +1837,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 c0d932449db3deed42a99bd948aab61e56b2d8441d7de5243688695ff04e8177
R 9abe58133bf0c1ae1a769c617adc4cd3
U drh
Z b575a9fb6c490182280eead5f3b52973
P 47e23064ba0205148f89e12803a62d5a4d6d2054f593f60c031e815112170b9b
R e89233ca9746832ca908e8f9e9b030aa
U dan
Z 89e5bf4fbbc31e53338b8409286bf1a6

View File

@ -1 +1 @@
47e23064ba0205148f89e12803a62d5a4d6d2054f593f60c031e815112170b9b
ee076c28d8ee0f5b099cdef83ae6cea6ef5aa209ab528d7c49949dd653ce019c

View File

@ -120,8 +120,9 @@ int sqlite3WalkSelectExpr(Walker *pWalker, Select *p){
{
Parse *pParse = pWalker->pParse;
if( pParse && IN_RENAME_OBJECT ){
/* The following may return WRC_Abort if there are unresolvable
** symbols (e.g. a table that does not exist) in a window definition. */
int rc = walkWindowList(pWalker, p->pWinDefn);
assert( rc==WRC_Continue );
return rc;
}
}

View File

@ -237,5 +237,40 @@ do_execsql_test 10.2 {
) IN () OR t1.a=5}
}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 11.1 {
CREATE TABLE t1(
a,b,c,d,e,f,g,h,j,jj,jjb,k,aa,bb,cc,dd,ee DEFAULT 3.14,
ff DEFAULT('hiccup'),Wg NOD NULL DEFAULT(false)
);
CREATE TRIGGER b AFTER INSERT ON t1 WHEN new.a BEGIN
SELECT a, sum() w3 FROM t1
WINDOW b AS (ORDER BY NOT EXISTS(SELECT 1 FROM abc));
END;
}
do_catchsql_test 11.2 {
ALTER TABLE t1 RENAME TO t1x;
} {1 {error in trigger b: no such table: abc}}
do_execsql_test 11.3 {
DROP TRIGGER b;
CREATE TRIGGER b AFTER INSERT ON t1 WHEN new.a BEGIN
SELECT a, sum() w3 FROM t1
WINDOW b AS (ORDER BY NOT EXISTS(SELECT 1 FROM t1));
END;
} {}
do_execsql_test 11.4 {
ALTER TABLE t1 RENAME TO t1x;
SELECT sql FROM sqlite_master WHERE name = 'b';
} {
{CREATE TRIGGER b AFTER INSERT ON "t1x" WHEN new.a BEGIN
SELECT a, sum() w3 FROM "t1x"
WINDOW b AS (ORDER BY NOT EXISTS(SELECT 1 FROM "t1x"));
END}
}
finish_test