SQLite

Check-in [7480db307c]
Login

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

Overview
Comment:Fix the patch on this branch so that it works with sub-queries, as well as views.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | tkt-61c853-A
Files: files | file ages | folders
SHA3-256: 7480db307c39b86bce269583e5917f5e1a3990500552fd98400ef3e7088c0b2a
User & Date: dan 2019-08-05 19:44:47.542
Context
2019-08-05
20:45
Add test cases to this branch. (Closed-Leaf check-in: f37317d81c user: dan tags: tkt-61c853-A)
19:44
Fix the patch on this branch so that it works with sub-queries, as well as views. (check-in: 7480db307c user: dan tags: tkt-61c853-A)
19:32
One of two options on how to address ticket [61c853857f40da49]. In this mode, we back out the documentation change of [https://www.sqlite.org/docsrc/info/07b7749da88d54e5|[07b7749da88d54e5]] and change the core to work as it has been documented to work since 2017, rather than how it has actually worked since 2009. (check-in: 09cd0c0c6e user: drh tags: tkt-61c853-A)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/select.c.
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
    Table *pTab = pFrom->pTab;
    assert( pTab!=0 );
    if( (pTab->tabFlags & TF_Ephemeral)!=0 ){
      /* A sub-query in the FROM clause of a SELECT */
      Select *pSel = pFrom->pSelect;
      if( pSel ){
        while( pSel->pPrior ) pSel = pSel->pPrior;
        sqlite3SelectAddColumnTypeAndCollation(
          pParse, pTab, pSel, SQLITE_AFF_BLOB
        );
      }
    }
  }
}
#endif









|
<
<







5192
5193
5194
5195
5196
5197
5198
5199


5200
5201
5202
5203
5204
5205
5206
    Table *pTab = pFrom->pTab;
    assert( pTab!=0 );
    if( (pTab->tabFlags & TF_Ephemeral)!=0 ){
      /* A sub-query in the FROM clause of a SELECT */
      Select *pSel = pFrom->pSelect;
      if( pSel ){
        while( pSel->pPrior ) pSel = pSel->pPrior;
        sqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSel, 0);


      }
    }
  }
}
#endif


Changes to src/window.c.
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
    );
    p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
    if( p->pSrc ){
      Table *pTab2;
      p->pSrc->a[0].pSelect = pSub;
      sqlite3SrcListAssignCursors(pParse, p->pSrc);
      pSub->selFlags |= SF_Expanded;
      pTab2 = sqlite3ResultSetOfSelect(pParse, pSub, SQLITE_AFF_BLOB);
      if( pTab2==0 ){
        rc = SQLITE_NOMEM;
      }else{
        memcpy(pTab, pTab2, sizeof(Table));
        pTab->tabFlags |= TF_Ephemeral;
        p->pSrc->a[0].pTab = pTab;
        pTab = pTab2;







|







990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
    );
    p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
    if( p->pSrc ){
      Table *pTab2;
      p->pSrc->a[0].pSelect = pSub;
      sqlite3SrcListAssignCursors(pParse, p->pSrc);
      pSub->selFlags |= SF_Expanded;
      pTab2 = sqlite3ResultSetOfSelect(pParse, pSub, 0);
      if( pTab2==0 ){
        rc = SQLITE_NOMEM;
      }else{
        memcpy(pTab, pTab2, sizeof(Table));
        pTab->tabFlags |= TF_Ephemeral;
        p->pSrc->a[0].pTab = pTab;
        pTab = pTab2;