Ensure that semantic SQL errors are always reported back up to the syntax

parser.  Also:  Improve the defense against invalid PRAGMA synchronous settings.

FossilOrigin-Name: 7aeade9a07f29bf26e50394042ea18d0121fe7a3
This commit is contained in:
drh 2015-04-17 15:58:33 +00:00
parent b8289a8b00
commit d99d28361e
5 changed files with 22 additions and 14 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\sfaulty\sassert()\sin\ssqlite3SelectNew().
D 2015-04-17T15:16:58.290
C Ensure\sthat\ssemantic\sSQL\serrors\sare\salways\sreported\sback\sup\sto\sthe\ssyntax\nparser.\s\sAlso:\s\sImprove\sthe\sdefense\sagainst\sinvalid\sPRAGMA\ssynchronous\ssettings.
D 2015-04-17T15:58:33.364
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in faaf75b89840659d74501bea269c7e33414761c1
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -176,7 +176,7 @@ F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79
F src/btree.c 127aceb71ba93f59bc9c6ba810e992a04299e98a
F src/btree.h 969adc948e89e449220ff0ff724c94bb2a52e9f1
F src/btreeInt.h 973a22a6fd61350b454ad614832b1f0a5e25a1e4
F src/build.c 01b969b20a44a3d9620e597d9af8242348123540
F src/build.c f82d394b9ad94be03a13d04edc2b6309ad5274e8
F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0
F src/complete.c a5cf5b4b56390cfb7b8636e8f7ddef90258dd575
F src/ctime.c 98f89724adc891a1a4c655bee04e33e716e05887
@ -223,7 +223,7 @@ F src/parse.y c4e0387bc88c8e21e5ba653e2578959a1f3cdbc7
F src/pcache.c 10539fb959849ad6efff80050541cab3d25089d4
F src/pcache.h b44658c9c932d203510279439d891a2a83e12ba8
F src/pcache1.c 69d137620a305f814398bd29a0c998038c0695e9
F src/pragma.c 633cb355ab30b197d4e8e9976f94378199439b76
F src/pragma.c 2a81f312cdb78bf0672a0484478ca3c1083028e9
F src/pragma.h 09c89bca58e9a44de2116cc8272b8d454657129f
F src/prepare.c 1fffbdcd6f8a0173a8f70d71f22528f4c0e1e3d3
F src/printf.c 08fa675c200aac29e561c6153f91f909ed17612f
@ -794,7 +794,7 @@ F test/pcache.test b09104b03160aca0d968d99e8cd2c5b1921a993d
F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
F test/permutations.test f9cc1dd987986c9d4949211c7a4ed55ec9aecba1
F test/pragma.test 2e3d20785e463d7eeed636cba16e742b5df88073
F test/pragma.test be7195f0aa72bdb8a512133e9640ac40f15b57a2
F test/pragma2.test f624a496a95ee878e81e59961eade66d5c00c028
F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c
F test/printf.test b3ff34e73d59124140eaf89f7672e21bc2ca5fcc
@ -1251,7 +1251,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P db8d9af4d04ee862995ffa13ae6dcd9a1fc72855
R a2d46793733766d02a97971b373ce378
P 620d19c3b462f5c4763ebd26513321431f21dd72
R 3232d5345bb2d152e6d22cf04db83714
U drh
Z 3bc04f03d72aa5c77d969deb6f174a4e
Z c636e6bb9960db85c57f7546f9b2327e

View File

@ -1 +1 @@
620d19c3b462f5c4763ebd26513321431f21dd72
7aeade9a07f29bf26e50394042ea18d0121fe7a3

View File

@ -142,9 +142,11 @@ void sqlite3FinishCoding(Parse *pParse){
assert( pParse->pToplevel==0 );
db = pParse->db;
if( db->mallocFailed ) return;
if( pParse->nested ) return;
if( pParse->nErr ) return;
if( db->mallocFailed || pParse->nErr ){
if( pParse->rc==SQLITE_OK ) pParse->rc = SQLITE_ERROR;
return;
}
/* Begin by generating some termination code at the end of the
** vdbe program

View File

@ -946,9 +946,9 @@ void sqlite3Pragma(
sqlite3ErrorMsg(pParse,
"Safety level may not be changed inside a transaction");
}else{
testcase( (getSafetyLevel(zRight,0,1)+1) & ~PAGER_SYNCHRONOUS_MASK );
pDb->safety_level = (getSafetyLevel(zRight,0,1)+1)
& PAGER_SYNCHRONOUS_MASK;
int iLevel = (getSafetyLevel(zRight,0,1)+1) & PAGER_SYNCHRONOUS_MASK;
if( iLevel==0 ) iLevel = 1;
pDb->safety_level = iLevel;
setAllPagerFlags(db);
}
}

View File

@ -226,6 +226,12 @@ do_test pragma-1.14.1 {
}
} {0}
do_test pragma-1.14.2 {
execsql {
PRAGMA synchronous=3;
PRAGMA synchronous;
}
} {0}
do_test pragma-1.14.3 {
execsql {
PRAGMA synchronous=10;
PRAGMA synchronous;