/ Check-in [96b6a76da0]
Login

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

Overview
Comment:Fix an incorrect NEVER() macro.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 96b6a76da09a94182414ec1a56da91728c37329d2b55f889e433054ca21605ce
User & Date: drh 2019-12-04 03:31:29
Context
2019-12-04
03:46
Fix a buffer overread that could occur in fts3 with corrupt %_stat records. check-in: e01fdbf9f7 user: dan tags: trunk
03:31
Fix an incorrect NEVER() macro. check-in: 96b6a76da0 user: drh tags: trunk
01:42
Fix a double-free that could occur when a component of a compound SELECT with an ORDER BY clause uses named window definitions. check-in: 92893b7980 user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/build.c.

1625
1626
1627
1628
1629
1630
1631


1632

1633
1634
1635
1636
1637
1638
1639
** column.
*/
void sqlite3AddGenerated(Parse *pParse, Expr *pExpr, Token *pType){
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
  u8 eType = COLFLAG_VIRTUAL;
  Table *pTab = pParse->pNewTable;
  Column *pCol;


  if( NEVER(pTab==0) ) goto generated_done;

  pCol = &(pTab->aCol[pTab->nCol-1]);
  if( IN_DECLARE_VTAB ){
    sqlite3ErrorMsg(pParse, "virtual tables cannot use computed columns");
    goto generated_done;
  }
  if( pCol->pDflt ) goto generated_error;
  if( pType ){







>
>
|
>







1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
** column.
*/
void sqlite3AddGenerated(Parse *pParse, Expr *pExpr, Token *pType){
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
  u8 eType = COLFLAG_VIRTUAL;
  Table *pTab = pParse->pNewTable;
  Column *pCol;
  if( pTab==0 ){
    /* generated column in an CREATE TABLE IF NOT EXISTS that already exists */
    goto generated_done;
  }
  pCol = &(pTab->aCol[pTab->nCol-1]);
  if( IN_DECLARE_VTAB ){
    sqlite3ErrorMsg(pParse, "virtual tables cannot use computed columns");
    goto generated_done;
  }
  if( pCol->pDflt ) goto generated_error;
  if( pType ){

Changes to test/gencol1.test.

257
258
259
260
261
262
263
264










265
do_execsql_test gencol1-9.20 {
  CREATE TABLE t3(aa INT PRIMARY KEY, bb UNIQUE AS(aa));
  INSERT INTO t3 VALUES(1);
  SELECT 100, * FROM t3;
  DELETE FROM t3 WHERE (SELECT bb FROM t3);
  SELECT 200, * FROM t3;
} {100 1 1}











finish_test








>
>
>
>
>
>
>
>
>
>

257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
do_execsql_test gencol1-9.20 {
  CREATE TABLE t3(aa INT PRIMARY KEY, bb UNIQUE AS(aa));
  INSERT INTO t3 VALUES(1);
  SELECT 100, * FROM t3;
  DELETE FROM t3 WHERE (SELECT bb FROM t3);
  SELECT 200, * FROM t3;
} {100 1 1}

# 2019-12-04 Generated column in a CREATE TABLE IF NOT EXISTS that
# does already exist.
#
sqlite3 db :memory:
do_execsql_test gencol1-10.10 {
  CREATE TABLE t1(aa,bb);
  CREATE TABLE IF NOT EXISTS t1(aa, bb AS (aa+1));
  PRAGMA integrity_check;
} {ok}

finish_test