/ Check-in [7bfe0f67]
Login

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

Overview
Comment:Bug fixes so that "make test" once against runs with no errors.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | generated-columns
Files: files | file ages | folders
SHA3-256: 7bfe0f679d8951b3e925bdf549efa0f8d6b514eddeaca69cbfddbd9476cfff5f
User & Date: drh 2019-10-17 14:21:07
Context
2019-10-17
15:59
Basic UPDATE functionality working for VIRTUAL columns. check-in: c21959d4 user: drh tags: generated-columns
14:21
Bug fixes so that "make test" once against runs with no errors. check-in: 7bfe0f67 user: drh tags: generated-columns
13:15
Fix the table_info and table_xinfo pragmas so that they work with virtual columns. Table_info omits virtual columns. Table_xinfo gives them a "hidden" flag of 2, and 3 for STORED columns. check-in: 069351b8 user: drh tags: generated-columns
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/insert.c.

1005
1006
1007
1008
1009
1010
1011

1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028

1029

1030
1031
1032

1033
1034
1035
1036
1037
1038
1039
    /* Compute data for all columns of the new entry, beginning
    ** with the first column.
    */
    nHidden = 0;
    iRegStore = regRowid+1;
    for(i=0; i<pTab->nCol; i++, iRegStore++){
      int k;

      assert( i>=nHidden );
      assert( iRegStore==sqlite3ColumnOfTable(pTab,i)+regRowid+1 );
      if( i==pTab->iPKey ){
        /* The value of the INTEGER PRIMARY KEY column is always a NULL.
        ** Whenever this column is read, the rowid will be substituted
        ** in its place.  Hence, fill this column with a NULL to avoid
        ** taking up data space with information that will never be used.
        ** As there may be shallow copies of this value, make it a soft-NULL */
        sqlite3VdbeAddOp1(v, OP_SoftNull, iRegStore);
        continue;
      }
      if( pTab->aCol[i].colFlags & COLFLAG_NOINSERT ){
        nHidden++;
        if( pTab->aCol[i].colFlags & COLFLAG_VIRTUAL ){
          /* Virtual columns are no stored */
          iRegStore--;
        }else{

          /* Hidden and stored columns get the default value */

          sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore);
        }
        continue;

      }
      if( pColumn ){
        for(j=0; j<pColumn->nId && pColumn->a[j].idx!=i; j++){}
        if( j>=pColumn->nId ){
          /* A column not named in the insert column list gets its
          ** default value */
          sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore);







>











|

|


|
>
|
>

<
|
>







1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033

1034
1035
1036
1037
1038
1039
1040
1041
1042
    /* Compute data for all columns of the new entry, beginning
    ** with the first column.
    */
    nHidden = 0;
    iRegStore = regRowid+1;
    for(i=0; i<pTab->nCol; i++, iRegStore++){
      int k;
      u32 colFlags;
      assert( i>=nHidden );
      assert( iRegStore==sqlite3ColumnOfTable(pTab,i)+regRowid+1 );
      if( i==pTab->iPKey ){
        /* The value of the INTEGER PRIMARY KEY column is always a NULL.
        ** Whenever this column is read, the rowid will be substituted
        ** in its place.  Hence, fill this column with a NULL to avoid
        ** taking up data space with information that will never be used.
        ** As there may be shallow copies of this value, make it a soft-NULL */
        sqlite3VdbeAddOp1(v, OP_SoftNull, iRegStore);
        continue;
      }
      if( ((colFlags = pTab->aCol[i].colFlags) & COLFLAG_NOINSERT)!=0 ){
        nHidden++;
        if( (colFlags & COLFLAG_VIRTUAL)!=0 ){
          /* Virtual columns are no stored */
          iRegStore--;
          continue;
        }else if( (colFlags & COLFLAG_STORED)!=0 || pColumn==0 ){
          /* Stored columns get the default value.  Also hidden columns
          ** that are not explicitly named in the INSERT */
          sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore);

          continue;
        }
      }
      if( pColumn ){
        for(j=0; j<pColumn->nId && pColumn->a[j].idx!=i; j++){}
        if( j>=pColumn->nId ){
          /* A column not named in the insert column list gets its
          ** default value */
          sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore);

Changes to src/pragma.c.

1098
1099
1100
1101
1102
1103
1104

1105
1106

1107
1108
1109
1110
1111
1112
1113
      Index *pPk = sqlite3PrimaryKeyIndex(pTab);
      pParse->nMem = 7;
      sqlite3CodeVerifySchema(pParse, iTabDb);
      sqlite3ViewGetColumnNames(pParse, pTab);
      for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
        int isHidden = 0;
        if( pCol->colFlags & COLFLAG_NOINSERT ){

          nHidden++;
          if( pPragma->iArg==0 ) continue;

          if( pCol->colFlags & COLFLAG_VIRTUAL ){
            isHidden = 2;  /* GENERATED ALWAYS AS ... VIRTUAL */
          }else if( pCol->colFlags & COLFLAG_VIRTUAL ){
            isHidden = 3;  /* GENERATED ALWAYS AS ... STORED */
          }else{
            isHidden = 1;  /* HIDDEN */
          }







>
|
|
>







1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
      Index *pPk = sqlite3PrimaryKeyIndex(pTab);
      pParse->nMem = 7;
      sqlite3CodeVerifySchema(pParse, iTabDb);
      sqlite3ViewGetColumnNames(pParse, pTab);
      for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
        int isHidden = 0;
        if( pCol->colFlags & COLFLAG_NOINSERT ){
          if( pPragma->iArg==0 ){
            nHidden++;
            continue;
          }
          if( pCol->colFlags & COLFLAG_VIRTUAL ){
            isHidden = 2;  /* GENERATED ALWAYS AS ... VIRTUAL */
          }else if( pCol->colFlags & COLFLAG_VIRTUAL ){
            isHidden = 3;  /* GENERATED ALWAYS AS ... STORED */
          }else{
            isHidden = 1;  /* HIDDEN */
          }