SQLite

Check-in [9c0d80907b]
Login

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

Overview
Comment:Make a hard copy of the results of a subquery lest the result of the subquery be referenced after a change to the table that generated the subquery result.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9c0d80907b4dee8ee8f205c2ebdb759f5ba1d771
User & Date: drh 2015-05-18 04:24:27.963
Context
2015-05-18
12:28
Transitive constraints should only work if operands have compatible affinities and collating sequences. (check-in: 5df4056448 user: drh tags: trunk)
04:24
Make a hard copy of the results of a subquery lest the result of the subquery be referenced after a change to the table that generated the subquery result. (check-in: 9c0d80907b user: drh tags: trunk)
2015-05-16
18:31
Fix a typo in a comment. No changes to code. (check-in: ee4b74250a user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/select.c.
709
710
711
712
713
714
715






716

717
718
719
720
721
722
723
724
709
710
711
712
713
714
715
716
717
718
719
720
721

722

723
724
725
726
727
728
729







+
+
+
+
+
+
-
+
-







      sqlite3VdbeAddOp3(v, OP_Column, srcTab, i, regResult+i);
      VdbeComment((v, "%s", pEList->a[i].zName));
    }
  }else if( eDest!=SRT_Exists ){
    /* If the destination is an EXISTS(...) expression, the actual
    ** values returned by the SELECT are not required.
    */
    u8 ecelFlags;
    if( eDest==SRT_Mem || eDest==SRT_Output || eDest==SRT_Coroutine ){
      ecelFlags = SQLITE_ECEL_DUP;
    }else{
      ecelFlags = 0;
    }
    sqlite3ExprCodeExprList(pParse, pEList, regResult,
    sqlite3ExprCodeExprList(pParse, pEList, regResult, ecelFlags);
                  (eDest==SRT_Output||eDest==SRT_Coroutine)?SQLITE_ECEL_DUP:0);
  }

  /* If the DISTINCT keyword was present on the SELECT statement
  ** and this row has been seen before, then do not make this row
  ** part of the result.
  */
  if( hasDistinct ){
Changes to test/misc4.test.
214
215
216
217
218
219
220










221
222
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232







+
+
+
+
+
+
+
+
+
+


sqlite3 db :memory:
do_catchsql_test misc4-7.1 {
  CREATE TABLE t7(x);
  PRAGMA writable_schema=ON;
  UPDATE sqlite_master SET sql='CREATE TABLE [M%s%s%s%s%s%s%s%s%s%s%s%s%s';
  VACUUM;
} {1 {unrecognized token: "[M%s%s%s%s%s%s%s%s%s%s%s%s%s"}}

# 2015-05-18.  Use of ephermeral Mem content after the cursor that holds
# the canonical content has moved on.
#
do_execsql_test misc4-7.2 {
  CREATE TABLE t0(a,b);
  INSERT INTO t0 VALUES(1,0),(2,0);
  UPDATE t0 SET b=9 WHERE a AND (SELECT a FROM t0 WHERE a);
  SELECT * FROM t0 ORDER BY +a;
} {1 9 2 9}

finish_test