mirror of https://github.com/sqlite/sqlite
Make sure "rowid" columns in views are named correctly. Ticket #3308. (CVS 5580)
FossilOrigin-Name: 8593218c7c8016fbdbcc223db951751eaba9c0dd
This commit is contained in:
parent
74073b6da8
commit
f0209f7410
14
manifest
14
manifest
|
@ -1,5 +1,5 @@
|
||||||
C Add\stest\scases\sto\sverify\sthat\sticket\s#3314\shas\sbeen\sfixed.\s(CVS\s5579)
|
C Make\ssure\s"rowid"\scolumns\sin\sviews\sare\snamed\scorrectly.\s\sTicket\s#3308.\s(CVS\s5580)
|
||||||
D 2008-08-21T14:24:29
|
D 2008-08-21T14:54:29
|
||||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||||
F Makefile.in 0b1c022000f55221454a7846022f11674d8024bf
|
F Makefile.in 0b1c022000f55221454a7846022f11674d8024bf
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
|
@ -145,7 +145,7 @@ F src/prepare.c c197041e0c4770672cda75e6bfe10242f885e510
|
||||||
F src/printf.c 2e984b2507291a7e16d89dc9bb60582904f6247d
|
F src/printf.c 2e984b2507291a7e16d89dc9bb60582904f6247d
|
||||||
F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a
|
F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a
|
||||||
F src/resolve.c e688f240bdacf4003047c2b023c3a4ee3a3eca98
|
F src/resolve.c e688f240bdacf4003047c2b023c3a4ee3a3eca98
|
||||||
F src/select.c eed74c3d00c45a01808a16aaca8a676e222bf2fa
|
F src/select.c e71462393fe0f9d2bf41378763b96659e8780e43
|
||||||
F src/shell.c d83b578a8ccdd3e0e7fef4388a0887ce9f810967
|
F src/shell.c d83b578a8ccdd3e0e7fef4388a0887ce9f810967
|
||||||
F src/sqlite.h.in 54e51c22e2294c5989156b0aec87aa44168ac1f0
|
F src/sqlite.h.in 54e51c22e2294c5989156b0aec87aa44168ac1f0
|
||||||
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
|
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
|
||||||
|
@ -575,7 +575,7 @@ F test/vacuum2.test d3b9691541fe6ed5c711f547a1c7d70e9760ac6f
|
||||||
F test/vacuum3.test 306b65554980d8d4a3b6eeb7b3ccd11c65ebb540
|
F test/vacuum3.test 306b65554980d8d4a3b6eeb7b3ccd11c65ebb540
|
||||||
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
|
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
|
||||||
F test/veryquick.test e265401afefa994cdf2fe4b6f286b1e87c2f9b9d
|
F test/veryquick.test e265401afefa994cdf2fe4b6f286b1e87c2f9b9d
|
||||||
F test/view.test 5799906511d6c77cfe3516d3d1189224350ef732
|
F test/view.test 7fba28a47f76541f6aea9542f62f3412e3519bad
|
||||||
F test/vtab1.test e321e3c80434fe8de97fa4ad815882d2c7838d21
|
F test/vtab1.test e321e3c80434fe8de97fa4ad815882d2c7838d21
|
||||||
F test/vtab2.test 1da49b015582965a8fc386aa23d051a5a622b08e
|
F test/vtab2.test 1da49b015582965a8fc386aa23d051a5a622b08e
|
||||||
F test/vtab3.test baad99fd27217f5d6db10660522e0b7192446de1
|
F test/vtab3.test baad99fd27217f5d6db10660522e0b7192446de1
|
||||||
|
@ -623,7 +623,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
|
||||||
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||||
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
|
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
P 6855711595b58d4b6fbaf9480720b788904d0e2d
|
P b46267ff07f9b967bb7aee16b6d9dd8d0bd23f0c
|
||||||
R f9dd7772aed55e02a1d2567ebef0881f
|
R 2254e4730c10ac23dce2d42c635a0f77
|
||||||
U drh
|
U drh
|
||||||
Z ee8b94f7984c53fadfdb88741ce8777a
|
Z c47aabc6550675841029fc54450540b2
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
b46267ff07f9b967bb7aee16b6d9dd8d0bd23f0c
|
8593218c7c8016fbdbcc223db951751eaba9c0dd
|
10
src/select.c
10
src/select.c
|
@ -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.467 2008/08/21 14:15:59 drh Exp $
|
** $Id: select.c,v 1.468 2008/08/21 14:54:29 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
|
@ -1167,12 +1167,14 @@ static int selectColumnsFromExprList(
|
||||||
zName = sqlite3DbStrDup(db, zName);
|
zName = sqlite3DbStrDup(db, zName);
|
||||||
}else{
|
}else{
|
||||||
Expr *pCol = p;
|
Expr *pCol = p;
|
||||||
|
Table *pTab;
|
||||||
while( pCol->op==TK_DOT ) pCol = pCol->pRight;
|
while( pCol->op==TK_DOT ) pCol = pCol->pRight;
|
||||||
if( pCol->op==TK_COLUMN && pCol->pTab ){
|
if( pCol->op==TK_COLUMN && (pTab = pCol->pTab)!=0 ){
|
||||||
/* For columns use the column name name */
|
/* For columns use the column name name */
|
||||||
int iCol = pCol->iColumn;
|
int iCol = pCol->iColumn;
|
||||||
if( iCol<0 ) iCol = pCol->pTab->iPKey;
|
if( iCol<0 ) iCol = pTab->iPKey;
|
||||||
zName = sqlite3MPrintf(db, "%s", pCol->pTab->aCol[iCol].zName);
|
zName = sqlite3MPrintf(db, "%s",
|
||||||
|
iCol>=0 ? pTab->aCol[iCol].zName : "rowid");
|
||||||
}else{
|
}else{
|
||||||
/* Use the original text of the column expression as its name */
|
/* Use the original text of the column expression as its name */
|
||||||
zName = sqlite3MPrintf(db, "%T", &pCol->span);
|
zName = sqlite3MPrintf(db, "%T", &pCol->span);
|
||||||
|
|
|
@ -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.37 2008/07/10 00:32:42 drh Exp $
|
# $Id: view.test,v 1.38 2008/08/21 14:54:29 drh Exp $
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
|
|
||||||
|
@ -538,5 +538,32 @@ do_test view-18.1 {
|
||||||
}
|
}
|
||||||
} {1 2 3 4 5 6}
|
} {1 2 3 4 5 6}
|
||||||
|
|
||||||
|
# Ticket #3308
|
||||||
|
# Make sure "rowid" columns in a view are named correctly.
|
||||||
|
#
|
||||||
|
do_test view-19.1 {
|
||||||
|
execsql {
|
||||||
|
CREATE VIEW v3308a AS SELECT rowid, * FROM t1;
|
||||||
|
}
|
||||||
|
execsql2 {
|
||||||
|
SELECT * FROM v3308a
|
||||||
|
}
|
||||||
|
} {rowid 1 a 1 b 2 c 3 rowid 2 a 4 b 5 c 6}
|
||||||
|
do_test view-19.2 {
|
||||||
|
execsql {
|
||||||
|
CREATE VIEW v3308b AS SELECT t1.rowid, t1.a, t1.b+t1.c FROM t1;
|
||||||
|
}
|
||||||
|
execsql2 {
|
||||||
|
SELECT * FROM v3308b
|
||||||
|
}
|
||||||
|
} {rowid 1 a 1 t1.b+t1.c 5 rowid 2 a 4 t1.b+t1.c 11}
|
||||||
|
do_test view-19.3 {
|
||||||
|
execsql {
|
||||||
|
CREATE VIEW v3308c AS SELECT t1.oid, A, t1.b+t1.c AS x FROM t1;
|
||||||
|
}
|
||||||
|
execsql2 {
|
||||||
|
SELECT * FROM v3308c
|
||||||
|
}
|
||||||
|
} {rowid 1 a 1 x 5 rowid 2 a 4 x 11}
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
|
Loading…
Reference in New Issue