/ Check-in [0dd3e2e4]
Login

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

Overview
Comment:Changes toward fixes for tickets #2296 and #2291. (CVS 3838)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:0dd3e2e47b09156838edfa4dea0d82f9cf22d94d
User & Date: drh 2007-04-12 21:25:02
Context
2007-04-13
02:14
Fix multiple performance regressions (ticket #2298 among them) and add tests to make sure they do not come back. (CVS 3839) check-in: 32bb2d58 user: drh tags: trunk
2007-04-12
21:25
Changes toward fixes for tickets #2296 and #2291. (CVS 3838) check-in: 0dd3e2e4 user: drh tags: trunk
03:54
Get the column affinities right when processing an IN operator where the right-hand side is a subquery with an ORDER BY clause. Ticket #2295. This bug has likely been present since version 3.0.0 and it has just now been noticed, so it seems to be a obscure case. (CVS 3837) check-in: 4062ddf3 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/select.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
2587
2588
2589
2590
2591
2592
2593
2594



2595
2596
2597
2598

2599
2600
2601
2602
2603
2604
2605
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.334 2007/04/12 03:54:39 drh Exp $
*/
#include "sqliteInt.h"


/*
** Delete all the content of a Select structure but do not deallocate
** the select structure itself.
................................................................................
  ** aliases in the result set.
  **
  ** Minor point: If this is the case, then the expression will be
  ** re-evaluated for each reference to it.
  */
  sNC.pEList = p->pEList;
  if( sqlite3ExprResolveNames(&sNC, p->pWhere) ||
      sqlite3ExprResolveNames(&sNC, p->pHaving) ||



      processOrderGroupBy(&sNC, p->pOrderBy, "ORDER") ||
      processOrderGroupBy(&sNC, pGroupBy, "GROUP")
  ){
    return SQLITE_ERROR;

  }

  /* Make sure the GROUP BY clause does not contain aggregate functions.
  */
  if( pGroupBy ){
    struct ExprList_item *pItem;
  







|







 







|
>
>
>
|
|
<
|
>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599

2600
2601
2602
2603
2604
2605
2606
2607
2608
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.335 2007/04/12 21:25:02 drh Exp $
*/
#include "sqliteInt.h"


/*
** Delete all the content of a Select structure but do not deallocate
** the select structure itself.
................................................................................
  ** aliases in the result set.
  **
  ** Minor point: If this is the case, then the expression will be
  ** re-evaluated for each reference to it.
  */
  sNC.pEList = p->pEList;
  if( sqlite3ExprResolveNames(&sNC, p->pWhere) ||
     sqlite3ExprResolveNames(&sNC, p->pHaving) ){
    return SQLITE_ERROR;
  }
  if( p->pPrior==0 ){
    if( processOrderGroupBy(&sNC, p->pOrderBy, "ORDER") ||
        processOrderGroupBy(&sNC, pGroupBy, "GROUP") ){

      return SQLITE_ERROR;
    }
  }

  /* Make sure the GROUP BY clause does not contain aggregate functions.
  */
  if( pGroupBy ){
    struct ExprList_item *pItem;
  

Changes to test/insert4.test.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the INSERT transfer optimization.
#
# $Id: insert4.test,v 1.4 2007/04/10 18:17:55 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# The sqlite3_xferopt_count variable is incremented whenever the 
# insert transfer optimization applies.
#
................................................................................
    {x integer, b int}


# Ticket #2291.
#
do_test insert4-4.1 {
  execsql {
    CREATE TABLE t4(a, b, PRIMARY KEY(a,b));
    INSERT INTO t4 VALUES(NULL,0);
    INSERT INTO t4 VALUES(NULL,1);
    INSERT INTO t4 VALUES(NULL,1);
    VACUUM;   
  }
} {}

finish_test







|







 







|








7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the INSERT transfer optimization.
#
# $Id: insert4.test,v 1.5 2007/04/12 21:25:02 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# The sqlite3_xferopt_count variable is incremented whenever the 
# insert transfer optimization applies.
#
................................................................................
    {x integer, b int}


# Ticket #2291.
#
do_test insert4-4.1 {
  execsql {
    CREATE TABLE t4(a, b, UNIQUE(a,b));
    INSERT INTO t4 VALUES(NULL,0);
    INSERT INTO t4 VALUES(NULL,1);
    INSERT INTO t4 VALUES(NULL,1);
    VACUUM;   
  }
} {}

finish_test