Fix a problem with renaming a table when a view or trigger within the schema uses a FILTER with an aggregate function that is not currently registered with the database.

FossilOrigin-Name: 2ac0e42f8ab7a9184c2a2efd13bd50ab51bc01f9f34e9e63591fd18db02dff54
This commit is contained in:
dan 2019-08-05 13:19:25 +00:00
parent 3cbbd195ca
commit 72d1eac673
4 changed files with 30 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Prevent\san\sfts5\stable\sfrom\sbeing\sits\sown\scontent\stable,\sor\spart\sof\sa\sview\sthat\sis\sthe\scontent\stable. C Fix\sa\sproblem\swith\srenaming\sa\stable\swhen\sa\sview\sor\strigger\swithin\sthe\sschema\suses\sa\sFILTER\swith\san\saggregate\sfunction\sthat\sis\snot\scurrently\sregistered\swith\sthe\sdatabase.
D 2019-08-05T12:55:56.569 D 2019-08-05T13:19:25.017
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -521,7 +521,7 @@ F src/pragma.h 4a9fabff14db4487a734dfeeb4be984ce662bfdccfae16145b9c732327735e13
F src/prepare.c 1fdf68a8add154bd1de978dde5a4819478e2576d5701b93db2c65d78c3daf1c8 F src/prepare.c 1fdf68a8add154bd1de978dde5a4819478e2576d5701b93db2c65d78c3daf1c8
F src/printf.c 9be6945837c839ba57837b4bc3af349eba630920fa5532aa518816defe42a7d4 F src/printf.c 9be6945837c839ba57837b4bc3af349eba630920fa5532aa518816defe42a7d4
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384 F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 6d57cfcb728fe1513fcbfb2bbd4192838b8cfe094616f72c7a54be55a550cc84 F src/resolve.c 1db9e08a91df0e0bcac4c5f3cd01ca86dd1be37b283efeb81139266f1c74e7a3
F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93 F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93
F src/select.c 1b8b5afee76e7d662b34c61705a638f7a6a20d5109515ca973c12343c84fb2d6 F src/select.c 1b8b5afee76e7d662b34c61705a638f7a6a20d5109515ca973c12343c84fb2d6
F src/shell.c.in e5351f14716065d6e00a0437d3910cbb1a9d4fa96af61f59f18e5623679fe605 F src/shell.c.in e5351f14716065d6e00a0437d3910cbb1a9d4fa96af61f59f18e5623679fe605
@ -633,7 +633,7 @@ F test/altermalloc.test 167a47de41b5c638f5f5c6efb59784002b196fff70f98d9b4ed3cd74
F test/altermalloc2.test fa7b1c1139ea39b8dec407cf1feb032ca8e0076bd429574969b619175ad0174b F test/altermalloc2.test fa7b1c1139ea39b8dec407cf1feb032ca8e0076bd429574969b619175ad0174b
F test/altertab.test b6901287474841cffbd8f90b098d3bd7d8445868b42caeb01b27034698f7245f F test/altertab.test b6901287474841cffbd8f90b098d3bd7d8445868b42caeb01b27034698f7245f
F test/altertab2.test 8883693952f6d7fb5f754dbf1d694ed780aa883027bef04cb1fb99a3b88c9272 F test/altertab2.test 8883693952f6d7fb5f754dbf1d694ed780aa883027bef04cb1fb99a3b88c9272
F test/altertab3.test 0f1e2801afb0b1b0b723ec016dda140aa5dc0d2d48846d5eead003fcd72828e8 F test/altertab3.test 9b868b9fc643af9a7d70c0dca984fc6ea91cbb9c5b0bfc678243f3d296c4be48
F test/amatch1.test b5ae7065f042b7f4c1c922933f4700add50cdb9f F test/amatch1.test b5ae7065f042b7f4c1c922933f4700add50cdb9f
F test/analyze.test 7168c8bffa5d5cbc53c05b7e9c7fcdd24b365a1bc5046ce80c45efa3c02e6b7c F test/analyze.test 7168c8bffa5d5cbc53c05b7e9c7fcdd24b365a1bc5046ce80c45efa3c02e6b7c
F test/analyze3.test ff62d9029e6deb2c914490c6b00caf7fae47cc85cdc046e4a0d0a4d4b87c71d8 F test/analyze3.test ff62d9029e6deb2c914490c6b00caf7fae47cc85cdc046e4a0d0a4d4b87c71d8
@ -1838,7 +1838,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 1bd4b97d6405c9b093f3bfed914c56088ee13e4a2242be62b74a86660f74f533 P b6d52c9364767ff4ab7279ae981afb97799299dcfaf38a0110c40ca82c72a825
R e92ea622f14cc1b4c90fee388e599b52 R 28ce5921d081582c0d1ccac9c38fc5f7
U dan U dan
Z c8a1ea238b46dd4eaa7276d7b60e185f Z 3ddbf0b6cdda36b7df15d0621b9689d7

View File

@ -1 +1 @@
b6d52c9364767ff4ab7279ae981afb97799299dcfaf38a0110c40ca82c72a825 2ac0e42f8ab7a9184c2a2efd13bd50ab51bc01f9f34e9e63591fd18db02dff54

View File

@ -934,8 +934,8 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
pExpr->op2++; pExpr->op2++;
pNC2 = pNC2->pNext; pNC2 = pNC2->pNext;
} }
assert( pDef!=0 ); assert( pDef!=0 || IN_RENAME_OBJECT );
if( pNC2 ){ if( pNC2 && pDef ){
assert( SQLITE_FUNC_MINMAX==NC_MinMaxAgg ); assert( SQLITE_FUNC_MINMAX==NC_MinMaxAgg );
testcase( (pDef->funcFlags & SQLITE_FUNC_MINMAX)!=0 ); testcase( (pDef->funcFlags & SQLITE_FUNC_MINMAX)!=0 );
pNC2->ncFlags |= NC_HasAgg | (pDef->funcFlags & SQLITE_FUNC_MINMAX); pNC2->ncFlags |= NC_HasAgg | (pDef->funcFlags & SQLITE_FUNC_MINMAX);

View File

@ -358,10 +358,29 @@ do_execsql_test 16.1 {
WITH t4 AS (SELECT * FROM t1) SELECT 33; WITH t4 AS (SELECT * FROM t1) SELECT 33;
END; END;
} }
do_execsql_test 16.2 { do_execsql_test 16.2 {
ALTER TABLE t1 RENAME TO t1x; ALTER TABLE t1 RENAME TO t1x;
} }
#-------------------------------------------------------------------------
reset_db
do_execsql_test 17.1 {
CREATE TABLE t1(a,b,c);
CREATE TRIGGER AFTER INSERT ON t1 WHEN new.a NOT NULL BEGIN
SELECT a () FILTER (WHERE a>0) FROM t1;
END;
}
do_execsql_test 17.2 {
ALTER TABLE t1 RENAME TO t1x;
ALTER TABLE t1x RENAME a TO aaa;
SELECT sql FROM sqlite_master WHERE type='trigger';
} {
{CREATE TRIGGER AFTER INSERT ON "t1x" WHEN new.aaa NOT NULL BEGIN
SELECT a () FILTER (WHERE aaa>0) FROM "t1x";
END}
}
finish_test finish_test