/ Check-in [778a9a6e]
Login

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

Overview
Comment:Correctly capture the error when a RETURNING clause appears on an attempt to UPDATE an eponymous virtual table. dbsqlfuzz 486f791cbe2dc45839310073e71367a1d8ad22dd.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 778a9a6e6f8d960fd55ac9be7eea20b1875a46192db85e63dddc61b632b30173
User & Date: drh 2021-04-02 20:43:26
Context
2021-04-03
19:23
Fix a crash in handling queries of the form "SELECT aggregate(DISTINCT tbl.col) FROM ... LEFT JOIN tbl ...". Fixes a problem introduced by [ef4ac0ddd297bbd3]. (check-in: 0dcf808d user: dan tags: trunk)
2021-04-02
20:43
Correctly capture the error when a RETURNING clause appears on an attempt to UPDATE an eponymous virtual table. dbsqlfuzz 486f791cbe2dc45839310073e71367a1d8ad22dd. (check-in: 778a9a6e user: drh tags: trunk)
19:55
Add experimental SQLITE_FCNTL_EXTERNAL_READER file control. (check-in: e16da5af user: dan tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/trigger.c.

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
    while( p ){
      Trigger *pTrig = (Trigger *)sqliteHashData(p);
      if( pTrig->pTabSchema==pTab->pSchema
       && 0==sqlite3StrICmp(pTrig->table, pTab->zName)
      ){
        pTrig->pNext = pList;
        pList = pTrig;
      }else if( pTrig->op==TK_RETURNING ){
        assert( pParse->bReturning );
        assert( &(pParse->u1.pReturning->retTrig) == pTrig );
        pTrig->table = pTab->zName;
        pTrig->pTabSchema = pTab->pSchema;
        pTrig->pNext = pList;
        pList = pTrig;
      }        







|







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
    while( p ){
      Trigger *pTrig = (Trigger *)sqliteHashData(p);
      if( pTrig->pTabSchema==pTab->pSchema
       && 0==sqlite3StrICmp(pTrig->table, pTab->zName)
      ){
        pTrig->pNext = pList;
        pList = pTrig;
      }else if( pTrig->op==TK_RETURNING && pParse->db->pVtabCtx==0 ){
        assert( pParse->bReturning );
        assert( &(pParse->u1.pReturning->retTrig) == pTrig );
        pTrig->table = pTab->zName;
        pTrig->pTabSchema = pTab->pSchema;
        pTrig->pNext = pList;
        pList = pTrig;
      }        

Changes to test/returning1.test.

179
180
181
182
183
184
185
186





187
} {1 {no such column: new.a}}
do_catchsql_test 8.3 {
  INSERT INTO t1 VALUES(3) RETURNING a, (SELECT c FROM t2 WHERE old.a=t2.b) AS x;
} {1 {no such column: old.a}}
do_catchsql_test 8.4 {
  INSERT INTO t1 VALUES(3) RETURNING a, (SELECT c FROM t2 WHERE t1.a=t2.b) AS x;
} {0 {3 40}}






finish_test








>
>
>
>
>

179
180
181
182
183
184
185
186
187
188
189
190
191
192
} {1 {no such column: new.a}}
do_catchsql_test 8.3 {
  INSERT INTO t1 VALUES(3) RETURNING a, (SELECT c FROM t2 WHERE old.a=t2.b) AS x;
} {1 {no such column: old.a}}
do_catchsql_test 8.4 {
  INSERT INTO t1 VALUES(3) RETURNING a, (SELECT c FROM t2 WHERE t1.a=t2.b) AS x;
} {0 {3 40}}

# dbsqlfuzz finds/crash-486f791cbe2dc45839310073e71367a1d8ad22dd
do_catchsql_test 9.1 {
  UPDATE pragma_encoding SET encoding='UTF-8' RETURNING a, b, *;
} {1 {table pragma_encoding may not be modified}}

finish_test