SQLite

Check-in [9b5d408864]
Login

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

Overview
Comment:Fix a problem caused by a small SQLITE_LIMIT_LENGTH value and a CREATE TABLE with a very large name.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | toobig-fix
Files: files | file ages | folders
SHA3-256: 9b5d408864920b302f2d21abcae1d90f1e0cd68b18262136554ba0e6219d6025
User & Date: dan 2019-04-09 20:50:44.500
Context
2019-04-09
21:37
New test case for SQLITE_TOOBIG errors. (check-in: 4c77fbbe5d user: drh tags: trunk)
20:50
Fix a problem caused by a small SQLITE_LIMIT_LENGTH value and a CREATE TABLE with a very large name. (Closed-Leaf check-in: 9b5d408864 user: dan tags: toobig-fix)
01:26
Use an unsigned integer to count free pages in btree.c:freePage2(). (check-in: 8820408597 user: drh tags: trunk)
Changes
Unified Diff Show Whitespace Changes Patch
Changes to src/build.c.
3218
3219
3220
3221
3222
3223
3224


3225
3226
3227
3228
3229
3230
3231
    }
  }else{
    int n;
    Index *pLoop;
    for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){}
    zName = sqlite3MPrintf(db, "sqlite_autoindex_%s_%d", pTab->zName, n);
    if( zName==0 ){


      goto exit_create_index;
    }

    /* Automatic index names generated from within sqlite3_declare_vtab()
    ** must have names that are distinct from normal automatic index names.
    ** The following statement converts "sqlite3_autoindex..." into
    ** "sqlite3_butoindex..." in order to make the names distinct.







>
>







3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
    }
  }else{
    int n;
    Index *pLoop;
    for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){}
    zName = sqlite3MPrintf(db, "sqlite_autoindex_%s_%d", pTab->zName, n);
    if( zName==0 ){
      if( db->mallocFailed==0 ) pParse->rc = SQLITE_TOOBIG;
      pParse->nErr++;
      goto exit_create_index;
    }

    /* Automatic index names generated from within sqlite3_declare_vtab()
    ** must have names that are distinct from normal automatic index names.
    ** The following statement converts "sqlite3_autoindex..." into
    ** "sqlite3_butoindex..." in order to make the names distinct.
Changes to test/sqllimits1.test.
885
886
887
888
889
890
891










892
  ))))
} "1 {too many columns in result set}"


foreach {key value} [array get saved] {
  catch {set $key $value}
}










finish_test







>
>
>
>
>
>
>
>
>
>

885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
  ))))
} "1 {too many columns in result set}"


foreach {key value} [array get saved] {
  catch {set $key $value}
}

#-------------------------------------------------------------------------
# At one point the following caused an assert() to fail.
#
sqlite3_limit db SQLITE_LIMIT_LENGTH 10000
set nm [string repeat x 10000]
do_catchsql_test sqllimits1-17.1 "
  CREATE TABLE $nm (x PRIMARY KEY)
" {1 {string or blob too big}}

finish_test