SQLite

Check-in [9a453f52a2]
Login

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

Overview
Comment:Fix a problem with a stale Select.pWith pointer when a CTE is used together with a compound query and an ORDER BY clause.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9a453f52a2b30595891604ede7d4acf61c2736a1
User & Date: drh 2015-04-12 17:35:27.113
Context
2015-04-12
21:28
Update the version number to 3.8.10 because of the new sort optimizations from check-in [79326d6eec]. (check-in: bd2cfa1d72 user: drh tags: trunk)
17:35
Fix a problem with a stale Select.pWith pointer when a CTE is used together with a compound query and an ORDER BY clause. (check-in: 9a453f52a2 user: drh tags: trunk)
01:22
Avoid problems when a query has a GROUP BY and an ORDER BY but no FROM clause. (check-in: e527d96a1e user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/select.c.
3879
3880
3881
3882
3883
3884
3885

3886
3887
3888
3889
3890
3891
3892
  p->op = TK_SELECT;
  p->pWhere = 0;
  pNew->pGroupBy = 0;
  pNew->pHaving = 0;
  pNew->pOrderBy = 0;
  p->pPrior = 0;
  p->pNext = 0;

  p->selFlags &= ~SF_Compound;
  assert( (p->selFlags & SF_Converted)==0 );
  p->selFlags |= SF_Converted;
  assert( pNew->pPrior!=0 );
  pNew->pPrior->pNext = pNew;
  pNew->pLimit = 0;
  pNew->pOffset = 0;







>







3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
  p->op = TK_SELECT;
  p->pWhere = 0;
  pNew->pGroupBy = 0;
  pNew->pHaving = 0;
  pNew->pOrderBy = 0;
  p->pPrior = 0;
  p->pNext = 0;
  p->pWith = 0;
  p->selFlags &= ~SF_Compound;
  assert( (p->selFlags & SF_Converted)==0 );
  p->selFlags |= SF_Converted;
  assert( pNew->pPrior!=0 );
  pNew->pPrior->pNext = pNew;
  pNew->pLimit = 0;
  pNew->pOffset = 0;
Changes to test/with1.test.
838
839
840
841
842
843
844






845
846
  WITH RECURSIVE c(i) AS (SELECT 5,* UNION ALL SELECT i+1 FROM c WHERE i<10)
  SELECT i FROM c;
} {1 {no tables specified}}
do_catchsql_test 13.3 {
  WITH RECURSIVE c(i,j) AS (SELECT 5,* UNION ALL SELECT i+1,11 FROM c WHERE i<10)
  SELECT i FROM c;
} {1 {table c has 1 values for 2 columns}}







finish_test







>
>
>
>
>
>


838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
  WITH RECURSIVE c(i) AS (SELECT 5,* UNION ALL SELECT i+1 FROM c WHERE i<10)
  SELECT i FROM c;
} {1 {no tables specified}}
do_catchsql_test 13.3 {
  WITH RECURSIVE c(i,j) AS (SELECT 5,* UNION ALL SELECT i+1,11 FROM c WHERE i<10)
  SELECT i FROM c;
} {1 {table c has 1 values for 2 columns}}

# 2015-04-12
#
do_execsql_test 14.1 {
  WITH x AS (SELECT * FROM t) SELECT 0 EXCEPT SELECT 0 ORDER BY 1 COLLATE binary;
} {}

finish_test