-C Fix\sa\sbug\sin\sthe\shandling\sof\sthe\sOR\soperator\sin\sFTS1.\s\sTest\scases\sadded\sto\nprevent\sa\srepeat.\s(CVS\s3450)
-D 2006-09-28T19:43:32
+C Make\ssure\smemory\sdoes\snot\sleak\swhen\spatching\sup\scolumn\snames\sso\sthat\nthey\sare\sunique\sin\sa\sjoin\sor\sview.\s\sTickets\s#1952\sand\s#2002.\s(CVS\s3451)
+D 2006-09-29T14:01:05
F Makefile.in cabd42d34340f49260bc2a7668c38eba8d4cfd99
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/prepare.c 3d9a1bb0644e8bccb3b78cb0833d269719237f4e
F src/printf.c b179b6ed12f793e028dd169e2e2e2b2a37eedc63
F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261
-F src/select.c 0d4724930a1f34c747105ed1802fa4af0d8eb519
+F src/select.c e247a5e1ea64dc3273a165549f0391fde8472f39
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
F src/shell.c 1c17cd03c9cc2ff618435156038f508c159ecf12
F src/sqlite.h.in bf935004029631fd93d119bcf2f7259b9cb9ad5e
F test/memleak.test df2b2b96e77f8ba159a332299535b1e5f18e49ac
F test/minmax.test 66434d8ee04869fe4c220b665b73748accbb9163
F test/misc1.test 27a6ad11ba6e4b73aeee650ab68053ad7dfd0433
-F test/misc2.test 9740c2fb7e4a69b2bebd4c5fd9ba45ae27b27e98
+F test/misc2.test 0b45deedcfd6ba857ea2f377c5669d3501a535c7
F test/misc3.test 7bd937e2c62bcc6be71939faf068d506467b1e03
F test/misc4.test b043a05dea037cca5989f3ae09552fa16119bc80
F test/misc5.test 83bceca3d38ed10ced00271e02b26b24795def83
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 0934d220b33c52024f42c89fa13326bd52333f39
-R 105e424a6b1cb9ae66050c731572cf3e
+P 8cdf1d6ae018dfc93f8f0962b2530e31aa0bebff
+R e0824515a1c2aeb5e0fc636e6263bbc4
U drh
-Z ffcf097b13ab31485785605d678fc1c5
+Z 2aee5ccd57b1e344909056652e85b596
-8cdf1d6ae018dfc93f8f0962b2530e31aa0bebff
\ No newline at end of file
+fcde639119c309c699ee9dd60ed60fd6e9c8c077
\ No newline at end of file
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
-** $Id: select.c,v 1.320 2006/08/11 19:08:27 drh Exp $
+** $Id: select.c,v 1.321 2006/09/29 14:01:05 drh Exp $
*/
#include "sqliteInt.h"
Expr *p, *pR;
char *zType;
char *zName;
- char *zBasename;
+ int nName;
CollSeq *pColl;
int cnt;
NameContext sNC;
/* Make sure the column name is unique. If the name is not unique,
** append a integer to the name so that it becomes unique.
*/
- zBasename = zName;
+ nName = strlen(zName);
for(j=cnt=0; j<i; j++){
if( sqlite3StrICmp(aCol[j].zName, zName)==0 ){
- zName = sqlite3MPrintf("%s:%d", zBasename, ++cnt);
+ zName[nName] = 0;
+ zName = sqlite3MPrintf("%z:%d", zName, ++cnt);
j = -1;
if( zName==0 ) break;
}
}
- if( zBasename!=zName ){
- sqliteFree(zBasename);
- }
pCol->zName = zName;
/* Get the typename, type affinity, and collating sequence for the
# This file implements tests for miscellanous features that were
# left out of other test files.
#
-# $Id: misc2.test,v 1.25 2006/08/16 16:42:48 drh Exp $
+# $Id: misc2.test,v 1.26 2006/09/29 14:01:07 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
INSERT INTO t2 VALUES(7,8,9);
}
} {}
+ifcapable subquery {
+ do_test misc2-2.2 {
+ execsql {
+ SELECT rowid, * FROM (SELECT * FROM t1, t2);
+ }
+ } {{} 1 2 3 7 8 9}
+}
ifcapable view {
- ifcapable subquery {
- do_test misc2-2.2 {
- execsql {
- SELECT rowid, * FROM (SELECT * FROM t1, t2);
- }
- } {{} 1 2 3 7 8 9}
- }
do_test misc2-2.3 {
execsql {
CREATE VIEW v1 AS SELECT * FROM t1, t2;
} {{} 1 2 3 7 8 9}
} ;# ifcapable view
+# Ticket #2002 and #1952.
+ifcapable subquery {
+ do_test misc2-2.4 {
+ execsql2 {
+ SELECT * FROM (SELECT a, b AS 'a', c AS 'a', 4 AS 'a' FROM t1)
+ }
+ } {a 1 a:1 2 a:2 3 a:3 4}
+}
+
# Check name binding precedence. Ticket #387
#
do_test misc2-3.1 {