]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Respect collation sequences in views. Ticket #1088. (CVS 2291)
authordanielk1977 <danielk1977@noemail.net>
Sun, 30 Jan 2005 11:11:44 +0000 (11:11 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Sun, 30 Jan 2005 11:11:44 +0000 (11:11 +0000)
FossilOrigin-Name: 9843c0dd795ceda3c260986f95b101a0cbc7cf64

manifest
manifest.uuid
src/select.c
test/subquery.test
test/view.test

index f623043654202ceabfb1e88448c930b6e689f910..5f4406fbfaf0e7bfc99fb0c7cbbdda224f15f8c5 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Have\sthe\soptimization\sintroduced\sin\s(2170)\sdeal\swith\sOP_NullRow\sas\swell\sas\sOP_Column\sand\sOP_Recno.\sFix\sfor\s#1086.\s(CVS\s2290)
-D 2005-01-30T09:17:59
+C Respect\scollation\ssequences\sin\sviews.\sTicket\s#1088.\s(CVS\s2291)
+D 2005-01-30T11:11:44
 F Makefile.in ffd81f5e926d40b457071b4de8d7c1fa18f39b5a
 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
@@ -58,7 +58,7 @@ F src/parse.y 959948ee97434a7bab3aa04094cd5be6b7501e8d
 F src/pragma.c c893f03104e94e0921861bd2d3dbd80c47515f7b
 F src/printf.c 3d20b21cfecadacecac3fb7274e746cb81d3d357
 F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
-F src/select.c b34d70980c08b6d324b06bee9f63ef91c18c6010
+F src/select.c 4382c7787651e0546d875e38f7fbe646f89bf7ab
 F src/shell.c 1f0da77ef0520afd6df71f4781076021874310f3
 F src/sqlite.h.in 7d7c28344e2bd770491b56ed9169be20859c707d
 F src/sqliteInt.h d5052f5a9badbde9e746e40522e8ab823b1670d5
@@ -183,7 +183,7 @@ F test/select5.test 2d414f712bff8e590091e08f9b7287600731be00
 F test/select6.test 6e5a1a70a788cdbe515d1252dd0917d7e9d1d71e
 F test/select7.test 8f3362336c10d828ab6fe9c1b8897b484da8b592
 F test/sort.test 87882e6c72a75d45e98a1c802c1ded0eac557d85
-F test/subquery.test ecec0780e2c8b101068e8780a012dcf1ef5194f4
+F test/subquery.test e607b55276d2536e17e75896cd245ec1c8838f1d
 F test/subselect.test 3f3f7a940dc3195c3139f4d530385cb54665d614
 F test/table.test a2a58cae70ef2511cbf27d40fb8f570106a2677e
 F test/tableapi.test 6a66d58b37d46dc0f2b3c7d4bd2617d209399bd1
@@ -208,7 +208,7 @@ F test/update.test 7669ca789d62c258b678e8aa7a22a57eac10f2cf
 F test/utf16.test 459c2f5ab80c60092c603630a348c32d6e59c558
 F test/vacuum.test f18eccdee5b538d46298c64d6a060cfbf97bbc23
 F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
-F test/view.test a34c5488932cb9f3daf5797b395da6444e570b98
+F test/view.test 306cc4342eb03c28de1a92c681836189e03e5af9
 F test/where.test ffb790dfda75d977bae7a1f5830351623f76861b
 F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
 F tool/lemon.c 4a3b5ccc76d959b8caa5f127d23a7e14d4470b4e
@@ -272,7 +272,7 @@ F www/tclsqlite.tcl e73f8f8e5f20e8277619433f7970060ab01088fc
 F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618
 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
 F www/whentouse.tcl 3e522a06ad41992023c80ca29a048ae2331ca5bd
-P 808e16a7dda048c214df24170da282087042ee3a
-R df5f8dcf1c9648630223cb55d1b73f5c
+P 356d31e03fe856642c5637f5ea5665947ff681fc
+R 1b4c9f179442697c3fe36efa149f562d
 U danielk1977
-Z edf636493d9bcd569445cc58d2b9e854
+Z 15b81717953dbbae339f907f8905d01e
index 20dd9d6d371c4f9ebfb2b98f7a07abcd9bd4594e..6cd060121bcbfc2d99cb28916cc827c72317a2df 100644 (file)
@@ -1 +1 @@
-356d31e03fe856642c5637f5ea5665947ff681fc
\ No newline at end of file
+9843c0dd795ceda3c260986f95b101a0cbc7cf64
\ No newline at end of file
index ab4265266972ff12a3d859477741bb9060b244b8..f54538c41fadba9c81d4bf9676f0991865847b0d 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** to handle SELECT statements in SQLite.
 **
-** $Id: select.c,v 1.235 2005/01/29 08:32:45 danielk1977 Exp $
+** $Id: select.c,v 1.236 2005/01/30 11:11:44 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 
@@ -857,6 +857,9 @@ Table *sqlite3ResultSetOfSelect(Parse *pParse, char *zTabName, Select *pSelect){
   if( prepSelectStmt(pParse, pSelect) ){
     return 0;
   }
+  if( sqlite3SelectResolve(pParse, pSelect, 0) ){
+    return 0;
+  }
   pTab = sqliteMalloc( sizeof(Table) );
   if( pTab==0 ){
     return 0;
@@ -989,7 +992,6 @@ static int prepSelectStmt(Parse *pParse, Select *p){
         pFrom->zAlias =
           sqlite3MPrintf("sqlite_subquery_%p_", (void*)pFrom->pSelect);
       }
-      sqlite3SelectResolve(pParse, pFrom->pSelect, 0);
       pFrom->pTab = pTab = 
         sqlite3ResultSetOfSelect(pParse, pFrom->zAlias, pFrom->pSelect);
       if( pTab==0 ){
index a5d9bc630da80fa8c9d7e4369946a8aa102dfb41..c76c08e2d2b0070cd279382d348891fc65563c6f 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this script is testing correlated subqueries
 #
-# $Id: subquery.test,v 1.3 2005/01/29 08:32:47 danielk1977 Exp $
+# $Id: subquery.test,v 1.4 2005/01/30 11:11:44 danielk1977 Exp $
 #
 
 set testdir [file dirname $argv0]
@@ -79,12 +79,24 @@ do_test subquery-1.7 {
 } {1 1 3 3 5 5 7 7}
 
 # Try an aggregate in both the subquery and the parent query.
-do_test subquery-1.6 {
+do_test subquery-1.8 {
   execsql {
     SELECT count(*) FROM t1 WHERE a > (SELECT count(*) FROM t2);
   }
 } {2}
 
+# Test a correlated subquery disables the "only open the index" optimization.
+do_test subquery-1.9.1 {
+  execsql {
+    SELECT (y*2)>b FROM t1, t2 WHERE a=x;
+  }
+} {0 1 1 1}
+do_test subquery-1.9.2 {
+  execsql {
+    SELECT a FROM t1 WHERE (SELECT (y*2)>b FROM t2 WHERE a=x); 
+  }
+} {3 5 7}
+
 
 #------------------------------------------------------------------
 # The following test cases - subquery-2.* - are not logically
index 77f7057e63a7a3b2842aa8f650ee4b1cfd472be9..cbcbe5c913554e64b18e6a1ed1aa75502c075062 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing VIEW statements.
 #
-# $Id: view.test,v 1.23 2005/01/29 08:32:47 danielk1977 Exp $
+# $Id: view.test,v 1.24 2005/01/30 11:11:44 danielk1977 Exp $
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
 
@@ -419,4 +419,25 @@ do_test view-10.2 {
   }
 } {2}
 
+do_test view-11.1 {
+  execsql {
+    CREATE TABLE t4(a COLLATE NOCASE);
+    INSERT INTO t4 VALUES('This');
+    INSERT INTO t4 VALUES('this');
+    INSERT INTO t4 VALUES('THIS');
+    SELECT * FROM t4 WHERE a = 'THIS';
+  }
+} {This this THIS}
+do_test view-11.2 {
+  execsql {
+    SELECT * FROM (SELECT * FROM t4) WHERE a = 'THIS';
+  }
+} {This this THIS}
+do_test view-11.3 {
+  execsql {
+    CREATE VIEW v11 AS SELECT * FROM t4;
+    SELECT * FROM v11 WHERE a = 'THIS';
+  }
+} {This this THIS}
+
 finish_test