From: drh Date: Thu, 9 Mar 2006 17:28:12 +0000 (+0000) Subject: Correct names returned from a query against a view. Ticket #1709, #1688, #1711.... X-Git-Tag: version-3.6.10~3039 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=643054c18bdd2bde6985853d74bd512afe852641;p=thirdparty%2Fsqlite.git Correct names returned from a query against a view. Ticket #1709, #1688, #1711. (CVS 3128) FossilOrigin-Name: 36830fafa405c9eae4795045efc6843394c67555 --- diff --git a/manifest b/manifest index 86c25a3dfa..c17c5055e2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sall\sreference\sto\sEXTERN\sfrom\stclsqlite.c.\s\sTicket\s#1687.\s(CVS\s3127) -D 2006-03-06T23:30:52 +C Correct\snames\sreturned\sfrom\sa\squery\sagainst\sa\sview.\s\sTicket\s#1709,\s#1688,\s#1711.\s(CVS\s3128) +D 2006-03-09T17:28:12 F Makefile.in 5d8dff443383918b700e495de42ec65bc1c8865b F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -66,7 +66,7 @@ F src/pragma.c 27d5e395c5d950931c7ac4fe610e7c2993e2fa55 F src/prepare.c fe3f5b7524575d378e82d3d7d4f1371884087c4e F src/printf.c 341e488b549b1a41f83b05a69ce1d7a8258b624c F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261 -F src/select.c c196faee625154a40d994be3de0a7725525d8531 +F src/select.c 38203fd2851e2accac1ece7a8f1ce68f1c6d86be F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96 F src/shell.c 7a4b16f85d8f6f25d917cdc3d0f7e18f84867adf F src/sqlite.h.in 0bf6f03f9a14dde5f3a4f87471840803acaa4497 @@ -279,7 +279,7 @@ F test/utf16align.test 7360e84472095518c56746f76b1f9d4dce99fb4d F test/vacuum.test 37f998b841cb335397c26d9bbc3457182af2565f F test/vacuum2.test 5aea8c88a65cb29f7d175296e7c819c6158d838c F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102 -F test/view.test 7606d16559f8d5830f209185b9ce8d754be288d2 +F test/view.test ef328f28f5658988f1a521720fb9cf940c9532a2 F test/where.test ee7c9a6659b07e1ee61177f6e7ff71565ee2c9df F test/where2.test fde821b9cb8e20d53ccd2e71482b063c5b1e222a F test/where3.test 6356013ce1c8ddc22a65c880dfff2b2c985634cb @@ -355,7 +355,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P e510e6dd9d6261f33b853af3b32d155b9d6b63b3 -R e2e0fca8ac4359425519457630a20ac4 +P b4d3e0d528c7d17fa3d05956a188cd4d431204b2 +R 51935685599ad30afbcbf808bc91dbf7 U drh -Z 5eb0109f1dc4aaae7998126e8d4fe6bc +Z 36810395a2addfbb68c63e8614294e10 diff --git a/manifest.uuid b/manifest.uuid index 040dd5dd3c..5b2b34da5d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b4d3e0d528c7d17fa3d05956a188cd4d431204b2 \ No newline at end of file +36830fafa405c9eae4795045efc6843394c67555 \ No newline at end of file diff --git a/src/select.c b/src/select.c index bb60291736..b8bd5f538f 100644 --- a/src/select.c +++ b/src/select.c @@ -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.306 2006/03/06 20:55:46 drh Exp $ +** $Id: select.c,v 1.307 2006/03/09 17:28:12 drh Exp $ */ #include "sqliteInt.h" @@ -2243,7 +2243,6 @@ static int flattenSubquery( ** We look at every expression in the outer query and every place we see ** "a" we substitute "x*3" and every place we see "b" we substitute "y+10". */ - substExprList(p->pEList, iParent, pSub->pEList); pList = p->pEList; for(i=0; inExpr; i++){ Expr *pExpr; @@ -2251,6 +2250,7 @@ static int flattenSubquery( pList->a[i].zName = sqliteStrNDup((char*)pExpr->span.z, pExpr->span.n); } } + substExprList(p->pEList, iParent, pSub->pEList); if( isAgg ){ substExprList(p->pGroupBy, iParent, pSub->pEList); substExpr(p->pHaving, iParent, pSub->pEList); diff --git a/test/view.test b/test/view.test index f6ddb2202b..49b2fbe879 100644 --- a/test/view.test +++ b/test/view.test @@ -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.29 2006/02/05 18:55:21 drh Exp $ +# $Id: view.test,v 1.30 2006/03/09 17:28:13 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -468,4 +468,19 @@ do_test view-14.1 { } } {1 {view t1 is circularly defined}} +# Tickets #1688, #1709 +# +do_test view-15.1 { + execsql2 { + CREATE VIEW v15 AS SELECT a AS x, b AS y FROM t1; + SELECT * FROM v15 LIMIT 1; + } +} {x 2 y 3} +do_test view-15.2 { + execsql2 { + SELECT x, y FROM v15 LIMIT 1 + } +} {x 2 y 3} + + finish_test