1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Correct names returned from a query against a view. Ticket #1709, #1688, #1711. (CVS 3128)

FossilOrigin-Name: 36830fafa405c9eae4795045efc6843394c67555
This commit is contained in:
drh
2006-03-09 17:28:12 +00:00
parent 86b7f57555
commit 643054c18b
4 changed files with 26 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
C Remove\sall\sreference\sto\sEXTERN\sfrom\stclsqlite.c.\s\sTicket\s#1687.\s(CVS\s3127) C Correct\snames\sreturned\sfrom\sa\squery\sagainst\sa\sview.\s\sTicket\s#1709,\s#1688,\s#1711.\s(CVS\s3128)
D 2006-03-06T23:30:52 D 2006-03-09T17:28:12
F Makefile.in 5d8dff443383918b700e495de42ec65bc1c8865b F Makefile.in 5d8dff443383918b700e495de42ec65bc1c8865b
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -66,7 +66,7 @@ F src/pragma.c 27d5e395c5d950931c7ac4fe610e7c2993e2fa55
F src/prepare.c fe3f5b7524575d378e82d3d7d4f1371884087c4e F src/prepare.c fe3f5b7524575d378e82d3d7d4f1371884087c4e
F src/printf.c 341e488b549b1a41f83b05a69ce1d7a8258b624c F src/printf.c 341e488b549b1a41f83b05a69ce1d7a8258b624c
F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261 F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261
F src/select.c c196faee625154a40d994be3de0a7725525d8531 F src/select.c 38203fd2851e2accac1ece7a8f1ce68f1c6d86be
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96 F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
F src/shell.c 7a4b16f85d8f6f25d917cdc3d0f7e18f84867adf F src/shell.c 7a4b16f85d8f6f25d917cdc3d0f7e18f84867adf
F src/sqlite.h.in 0bf6f03f9a14dde5f3a4f87471840803acaa4497 F src/sqlite.h.in 0bf6f03f9a14dde5f3a4f87471840803acaa4497
@@ -279,7 +279,7 @@ F test/utf16align.test 7360e84472095518c56746f76b1f9d4dce99fb4d
F test/vacuum.test 37f998b841cb335397c26d9bbc3457182af2565f F test/vacuum.test 37f998b841cb335397c26d9bbc3457182af2565f
F test/vacuum2.test 5aea8c88a65cb29f7d175296e7c819c6158d838c F test/vacuum2.test 5aea8c88a65cb29f7d175296e7c819c6158d838c
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102 F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
F test/view.test 7606d16559f8d5830f209185b9ce8d754be288d2 F test/view.test ef328f28f5658988f1a521720fb9cf940c9532a2
F test/where.test ee7c9a6659b07e1ee61177f6e7ff71565ee2c9df F test/where.test ee7c9a6659b07e1ee61177f6e7ff71565ee2c9df
F test/where2.test fde821b9cb8e20d53ccd2e71482b063c5b1e222a F test/where2.test fde821b9cb8e20d53ccd2e71482b063c5b1e222a
F test/where3.test 6356013ce1c8ddc22a65c880dfff2b2c985634cb F test/where3.test 6356013ce1c8ddc22a65c880dfff2b2c985634cb
@@ -355,7 +355,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P e510e6dd9d6261f33b853af3b32d155b9d6b63b3 P b4d3e0d528c7d17fa3d05956a188cd4d431204b2
R e2e0fca8ac4359425519457630a20ac4 R 51935685599ad30afbcbf808bc91dbf7
U drh U drh
Z 5eb0109f1dc4aaae7998126e8d4fe6bc Z 36810395a2addfbb68c63e8614294e10

View File

@@ -1 +1 @@
b4d3e0d528c7d17fa3d05956a188cd4d431204b2 36830fafa405c9eae4795045efc6843394c67555

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite. ** 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" #include "sqliteInt.h"
@@ -2243,7 +2243,6 @@ static int flattenSubquery(
** We look at every expression in the outer query and every place we see ** 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". ** "a" we substitute "x*3" and every place we see "b" we substitute "y+10".
*/ */
substExprList(p->pEList, iParent, pSub->pEList);
pList = p->pEList; pList = p->pEList;
for(i=0; i<pList->nExpr; i++){ for(i=0; i<pList->nExpr; i++){
Expr *pExpr; Expr *pExpr;
@@ -2251,6 +2250,7 @@ static int flattenSubquery(
pList->a[i].zName = sqliteStrNDup((char*)pExpr->span.z, pExpr->span.n); pList->a[i].zName = sqliteStrNDup((char*)pExpr->span.z, pExpr->span.n);
} }
} }
substExprList(p->pEList, iParent, pSub->pEList);
if( isAgg ){ if( isAgg ){
substExprList(p->pGroupBy, iParent, pSub->pEList); substExprList(p->pGroupBy, iParent, pSub->pEList);
substExpr(p->pHaving, iParent, pSub->pEList); substExpr(p->pHaving, iParent, pSub->pEList);

View File

@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this file is testing VIEW statements. # 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] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@@ -468,4 +468,19 @@ do_test view-14.1 {
} }
} {1 {view t1 is circularly defined}} } {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 finish_test