SQLite

Check-in [40549bac]
Login

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

Overview
Comment:Ensure that the expression of a virtual column really is an expression and not just a reference to another column, as a real expression is necessary for the indexed expression coverage optimization to work properly. Forum thread 07b36e3899a9ae21.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 40549bacb3923e439627b0103bedd7da30258b69a46960040f7176e060f51f2f
User & Date: drh 2022-12-21 14:13:49
Context
2022-12-21
19:11
More efficient implementation of large precisions on the "%c" format for the built-in printf(). This is an effort to avoid a reported timeout on a (ridiculous) query generated by OSSFuzz. (check-in: 371f9b88 user: drh tags: trunk)
18:28
Sync w/trunk prior to branch-purpose changes. (Leaf check-in: ae8f623f user: larrybr tags: extension_opts)
14:13
Ensure that the expression of a virtual column really is an expression and not just a reference to another column, as a real expression is necessary for the indexed expression coverage optimization to work properly. Forum thread 07b36e3899a9ae21. (check-in: 40549bac user: drh tags: trunk)
12:18
New WHERETRACE entries for adding and removing objects from the Parse.pIdxEpr list as part of indexed expression coverage. Debug and testing changes only - no affect on production builds. (check-in: 4dc438a9 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/build.c.

2000
2001
2002
2003
2004
2005
2006







2007
2008
2009
2010
2011
2012
2013
  pCol->colFlags |= eType;
  assert( TF_HasVirtual==COLFLAG_VIRTUAL );
  assert( TF_HasStored==COLFLAG_STORED );
  pTab->tabFlags |= eType;
  if( pCol->colFlags & COLFLAG_PRIMKEY ){
    makeColumnPartOfPrimaryKey(pParse, pCol); /* For the error message */
  }







  sqlite3ColumnSetExpr(pParse, pTab, pCol, pExpr);
  pExpr = 0;
  goto generated_done;

generated_error:
  sqlite3ErrorMsg(pParse, "error in generated column \"%s\"",
                  pCol->zCnName);







>
>
>
>
>
>
>







2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
  pCol->colFlags |= eType;
  assert( TF_HasVirtual==COLFLAG_VIRTUAL );
  assert( TF_HasStored==COLFLAG_STORED );
  pTab->tabFlags |= eType;
  if( pCol->colFlags & COLFLAG_PRIMKEY ){
    makeColumnPartOfPrimaryKey(pParse, pCol); /* For the error message */
  }
  if( ALWAYS(pExpr) && pExpr->op==TK_ID ){
    /* The value of a generated column needs to be a real expression, not
    ** just a reference to another column, in order for covering index
    ** optimizations to work correctly.  So if the value is not an expression,
    ** turn it into one by adding a unary "+" operator. */
    pExpr = sqlite3PExpr(pParse, TK_UPLUS, pExpr, 0);
  }
  sqlite3ColumnSetExpr(pParse, pTab, pCol, pExpr);
  pExpr = 0;
  goto generated_done;

generated_error:
  sqlite3ErrorMsg(pParse, "error in generated column \"%s\"",
                  pCol->zCnName);