/ Check-in [7aeade9a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Ensure that semantic SQL errors are always reported back up to the syntax parser. Also: Improve the defense against invalid PRAGMA synchronous settings.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7aeade9a07f29bf26e50394042ea18d0121fe7a3
User & Date: drh 2015-04-17 15:58:33
Context
2015-04-17
16:12
Remove an ALWAYS() that turns out to be false when there is a semantic error on a compound SELECT. check-in: ad67a67c user: drh tags: trunk
15:58
Ensure that semantic SQL errors are always reported back up to the syntax parser. Also: Improve the defense against invalid PRAGMA synchronous settings. check-in: 7aeade9a user: drh tags: trunk
15:16
Fix a faulty assert() in sqlite3SelectNew(). check-in: 620d19c3 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/build.c.

138
139
140
141
142
143
144
145
146
147



148
149
150
151
152
153
154
*/
void sqlite3FinishCoding(Parse *pParse){
  sqlite3 *db;
  Vdbe *v;

  assert( pParse->pToplevel==0 );
  db = pParse->db;
  if( db->mallocFailed ) return;
  if( pParse->nested ) return;
  if( pParse->nErr ) return;




  /* Begin by generating some termination code at the end of the
  ** vdbe program
  */
  v = sqlite3GetVdbe(pParse);
  assert( !pParse->isMultiWrite 
       || sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));







<

|
>
>
>







138
139
140
141
142
143
144

145
146
147
148
149
150
151
152
153
154
155
156
*/
void sqlite3FinishCoding(Parse *pParse){
  sqlite3 *db;
  Vdbe *v;

  assert( pParse->pToplevel==0 );
  db = pParse->db;

  if( pParse->nested ) 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
  */
  v = sqlite3GetVdbe(pParse);
  assert( !pParse->isMultiWrite 
       || sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));

Changes to src/pragma.c.

942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
    if( !zRight ){
      returnSingleInt(pParse, "synchronous", pDb->safety_level-1);
    }else{
      if( !db->autoCommit ){
        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;
        setAllPagerFlags(db);
      }
    }
    break;
  }
#endif /* SQLITE_OMIT_PAGER_PRAGMAS */








|
|
|







942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
    if( !zRight ){
      returnSingleInt(pParse, "synchronous", pDb->safety_level-1);
    }else{
      if( !db->autoCommit ){
        sqlite3ErrorMsg(pParse, 
            "Safety level may not be changed inside a transaction");
      }else{
        int iLevel = (getSafetyLevel(zRight,0,1)+1) & PAGER_SYNCHRONOUS_MASK;
        if( iLevel==0 ) iLevel = 1;
        pDb->safety_level = iLevel;
        setAllPagerFlags(db);
      }
    }
    break;
  }
#endif /* SQLITE_OMIT_PAGER_PRAGMAS */

Changes to test/pragma.test.

222
223
224
225
226
227
228






229
230
231
232
233
234
235
do_test pragma-1.14.1 {
  execsql {
    PRAGMA synchronous=4;
    PRAGMA synchronous;
  }
} {0}
do_test pragma-1.14.2 {






  execsql {
    PRAGMA synchronous=10;
    PRAGMA synchronous;
  }
} {2}
} ;# ifcapable pager_pragmas








>
>
>
>
>
>







222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
do_test pragma-1.14.1 {
  execsql {
    PRAGMA synchronous=4;
    PRAGMA synchronous;
  }
} {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;
  }
} {2}
} ;# ifcapable pager_pragmas