/ Check-in [68eac748]
Login

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

Overview
Comment:Fix a very obscure problem following OOM in sqlite3_declare_vtab().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 68eac74874d0646369bef3650c6cb271cca62ab4
User & Date: drh 2016-08-05 14:35:47
Context
2016-08-05
15:34
Remove an incorrect ALWAYS() statement and add a test case to show when the condition is sometimes false. check-in: 0f57effa user: drh tags: trunk
14:35
Fix a very obscure problem following OOM in sqlite3_declare_vtab(). check-in: 68eac748 user: drh tags: trunk
2016-08-04
13:23
Revert the SQLITE_APICALL changes for now. That changes needs further research before it is released. Deferred until 3.15. check-in: 9adda385 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

  3033   3033       int n;
  3034   3034       Index *pLoop;
  3035   3035       for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){}
  3036   3036       zName = sqlite3MPrintf(db, "sqlite_autoindex_%s_%d", pTab->zName, n);
  3037   3037       if( zName==0 ){
  3038   3038         goto exit_create_index;
  3039   3039       }
         3040  +
         3041  +    /* Automatic index names generated from within sqlite3_declare_vtab()
         3042  +    ** must have names that are distinct from normal automatic index names.
         3043  +    ** The following statement converts "sqlite3_autoindex..." into
         3044  +    ** "sqlite3_butoindex..." in order to make the names distinct.
         3045  +    ** The "vtab_err.test" test demonstrates the need of this statement. */
         3046  +    if( IN_DECLARE_VTAB ) zName[7]++;
  3040   3047     }
  3041   3048   
  3042   3049     /* Check for authorization to create an index.
  3043   3050     */
  3044   3051   #ifndef SQLITE_OMIT_AUTHORIZATION
  3045   3052     {
  3046   3053       const char *zDb = pDb->zName;