SQLite

Check-in [52a3d88519]
Login

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

Overview
Comment:Fix a bug in secondary index initialization when the secondary index is a superset of the PRIMARY KEY for a WITHOUT ROWID table.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | omit-rowid
Files: files | file ages | folders
SHA1: 52a3d885192c5d31f956c5ee17e29e2d1f3d5c9f
User & Date: drh 2013-11-05 17:30:04.337
Context
2013-11-05
19:41
Fix conflict handling for the case when the rowid uses REPLACE but other unique constraints use FAIL or IGNORE. (check-in: 573cc27427 user: drh tags: omit-rowid)
17:30
Fix a bug in secondary index initialization when the secondary index is a superset of the PRIMARY KEY for a WITHOUT ROWID table. (check-in: 52a3d88519 user: drh tags: omit-rowid)
16:56
Remove an "explain" command from test script without_rowid1.test that was accidentally committed. (check-in: 4b41d989e8 user: dan tags: omit-rowid)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/build.c.
1672
1673
1674
1675
1676
1677
1678

1679



1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691

  /* Update the in-memory representation of all UNIQUE indices by converting
  ** the final rowid column into one or more columns of the PRIMARY KEY.
  */
  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
    int n;
    if( pIdx->autoIndex==2 ) continue;

    if( pIdx->nKeyCol==pTab->nCol ){



      pIdx->nColumn = pTab->nCol;
      continue;
    }
    for(i=n=0; i<nPk; i++){
      if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ) n++;
    }
    if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return;
    for(i=0, j=pIdx->nKeyCol; i<nPk; i++){
      if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ){
        pIdx->aiColumn[j] = pPk->aiColumn[i];
        pIdx->azColl[j] = pPk->azColl[i];
        j++;







>
|
>
>
>
|

<
<
<







1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685



1686
1687
1688
1689
1690
1691
1692

  /* Update the in-memory representation of all UNIQUE indices by converting
  ** the final rowid column into one or more columns of the PRIMARY KEY.
  */
  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
    int n;
    if( pIdx->autoIndex==2 ) continue;
    for(i=n=0; i<nPk; i++){
      if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ) n++;
    }
    if( n==0 ){
      /* This index is a superset of the primary key */
      pIdx->nColumn = pIdx->nKeyCol;
      continue;



    }
    if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return;
    for(i=0, j=pIdx->nKeyCol; i<nPk; i++){
      if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ){
        pIdx->aiColumn[j] = pPk->aiColumn[i];
        pIdx->azColl[j] = pPk->azColl[i];
        j++;