SQLite

Check-in [104a2beb57]
Login

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

Overview
Comment:Restore generated column loop detection logic that was incorrectly removed from the previous check-in [9e07b48934e9a972]. This fixes ticket [299b50ba812d8e54]
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 104a2beb57037f9353ffa77096aae0eb64e4682e667f31623bfd3d064dd8d881
User & Date: drh 2019-11-07 02:32:54.155
Context
2019-11-07
14:51
Fix the xferCompatibleIndex() function so that it recognizes that a PRIMARY KEY index for a WITHOUT ROWID table is different from a UNIQUE constraint index on the primary key. Ticket [302027baf1374498] check-in: 34f64f11ca user: drh tags: trunk
02:32
Restore generated column loop detection logic that was incorrectly removed from the previous check-in [9e07b48934e9a972]. This fixes ticket [299b50ba812d8e54] check-in: 104a2beb57 user: drh tags: trunk
2019-11-06
22:19
Change the way generated columns are computed so that no column is computed inside branch code that might not be taken. Ticket [4fc08501f4e56692] check-in: 9e07b48934 user: drh tags: trunk
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/expr.c.
3641
3642
3643
3644
3645
3646
3647







3648



3649
3650
3651
3652
3653
3654
3655
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654

3655
3656
3657
3658
3659
3660
3661
3662
3663
3664







+
+
+
+
+
+
+
-
+
+
+







            return -1-pParse->iSelfTab;
          }
          pCol = pTab->aCol + iCol;
          testcase( iCol!=sqlite3TableColumnToStorage(pTab,iCol) );
          iSrc = sqlite3TableColumnToStorage(pTab, iCol) - pParse->iSelfTab;
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
          if( pCol->colFlags & COLFLAG_GENERATED ){
            if( pCol->colFlags & COLFLAG_BUSY ){
              sqlite3ErrorMsg(pParse, "generated column loop on \"%s\"",
                              pCol->zName);
              return 0;
            }
            pCol->colFlags |= COLFLAG_BUSY;
            if( pCol->colFlags & COLFLAG_NOTAVAIL ){
            sqlite3ExprCodeGeneratedColumn(pParse, pCol, iSrc);
              sqlite3ExprCodeGeneratedColumn(pParse, pCol, iSrc);
            }
            pCol->colFlags &= ~(COLFLAG_BUSY|COLFLAG_NOTAVAIL);
            return iSrc;
          }else
#endif /* SQLITE_OMIT_GENERATED_COLUMNS */
          if( pCol->affinity==SQLITE_AFF_REAL ){
            sqlite3VdbeAddOp2(v, OP_SCopy, iSrc, target);
            sqlite3VdbeAddOp1(v, OP_RealAffinity, target);
            return target;
Changes to test/gencol1.test.
229
230
231
232
233
234
235










236
237
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247







+
+
+
+
+
+
+
+
+
+


    c0 AS (('a', 9) < ('b', c1)),
    c1 AS (1),
    c2 CHECK (1 = c1)
  );
  INSERT INTO t0 VALUES (0),(99);
  SELECT * FROM t0;
} {1 1 0 1 1 99}
do_catchsql_test gencol1-8.20 {
  DROP TABLE IF EXISTS t0;
  CREATE TABLE t0(
    c0,
    c1 AS(c0 + c2),
    c2 AS(c1) CHECK(c2)
  );
  UPDATE t0 SET c0 = NULL;
} {1 {generated column loop on "c2"}}


finish_test