Column names coming back from a SELECT are now just the name of the
source column without the "table." prefix. In other words, "PRAGMA short_column_names=ON" is now the default. This makes the names of columns behave more like other SQL engines. The old behavior can be restored by setting "PRAGMA short_column_names=OFF". (CVS 2231) FossilOrigin-Name: 9295050af1bf2d9d4dc63adc225a2848d67cbe17
This commit is contained in:
parent
9b3187e113
commit
47a6db2bfd
18
manifest
18
manifest
@ -1,5 +1,5 @@
|
||||
C Continue\srefactoring\sname\sresolution.\s\sFix\sfor\sticket\s#1047.\s(CVS\s2230)
|
||||
D 2005-01-18T14:45:48
|
||||
C Column\snames\scoming\sback\sfrom\sa\sSELECT\sare\snow\sjust\sthe\sname\sof\sthe\nsource\scolumn\swithout\sthe\s"table."\sprefix.\sIn\sother\swords,\n"PRAGMA\sshort_column_names=ON"\sis\snow\sthe\sdefault.\nThis\smakes\sthe\snames\sof\scolumns\sbehave\smore\slike\sother\sSQL\sengines.\nThe\sold\sbehavior\scan\sbe\srestored\sby\ssetting\s"PRAGMA\sshort_column_names=OFF".\s(CVS\s2231)
|
||||
D 2005-01-18T16:02:40
|
||||
F Makefile.in ffd81f5e926d40b457071b4de8d7c1fa18f39b5a
|
||||
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
|
||||
F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
|
||||
@ -41,7 +41,7 @@ F src/hash.c a97721a55440b7bea31ffe471bb2f6b4123cddd5
|
||||
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
|
||||
F src/insert.c 18d506e14d200378902747d13d7fb2a43fb3d31d
|
||||
F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
|
||||
F src/main.c cbe5a05baabad9fabb733065d0fb00c0b36f6ef1
|
||||
F src/main.c b489aae242a6123b111f125633799e37c0bab2a8
|
||||
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
|
||||
F src/os.h ae44064dc118b20d39450cb331409a775e8bb1c6
|
||||
F src/os_common.h 0e7f428ba0a6c40a61bc56c4e96f493231301b73
|
||||
@ -57,7 +57,7 @@ F src/parse.y ceba179b9703657180963568f54b0e75f33e36e1
|
||||
F src/pragma.c ac594f74c90ffec043c43e49358719ffeb491eec
|
||||
F src/printf.c 3d20b21cfecadacecac3fb7274e746cb81d3d357
|
||||
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
|
||||
F src/select.c 767e9d0f0652ff8d319c13cc72a8eef4098ce30e
|
||||
F src/select.c 56f018292ce467c276440916d455671d884e9141
|
||||
F src/shell.c 591364a0e9ca4ce53873e21e0294476c0c2b4770
|
||||
F src/sqlite.h.in 0d5e48e506845b74a845c9470e01d3f472b59611
|
||||
F src/sqliteInt.h c6414179a23cab108b4b07e8665f30829ce47f2a
|
||||
@ -138,7 +138,7 @@ F test/insert3.test fa7cb5b01709a1bca3e28c82c80c1d44386b3676
|
||||
F test/interrupt.test 5b4d8389e6cf2d01b94f87cfd02d9df1073bfb2d
|
||||
F test/intpkey.test b57cf5236fde1bd8cbc1388fa0c91908f6fd9194
|
||||
F test/ioerr.test 43cdd9dcbdedc2ec952031b3e53d3d5a4ee26000
|
||||
F test/join.test ea8c77b9fbc377fe553cdb5ce5f1bd72021dca5d
|
||||
F test/join.test 76a6450903d641425bd2f6b773f02f68947f2a0e
|
||||
F test/join2.test c97e4c5aa65dea462145529e58212a709b4722b8
|
||||
F test/join3.test 67dc0d7c8dab3fff25796d0f3c3fd9c999aeded3
|
||||
F test/join4.test 8dec387d06b3a4685e1104048065cf5236b99b93
|
||||
@ -173,7 +173,7 @@ F test/reindex.test 3552c6b944a3fab28cfd3049c04c65cb79419757
|
||||
F test/rollback.test 94cd981ee3a627d9f6466f69dcf1f7dbfe695d7a
|
||||
F test/rowid.test 1ce3f1520d2082b0363e7d9bdef904cb72b9efe8
|
||||
F test/safety.test 907b64fee719554a3622853812af3886fddbbb4f
|
||||
F test/select1.test 2b08187aff4685231aec312e7776a5894eefd9e8
|
||||
F test/select1.test 0b4d3883a9c4e4b78e9f81b4f5d339e4e1494d26
|
||||
F test/select2.test 91a2225926039b0d1687840735c284dbbf89f0bc
|
||||
F test/select3.test 9de435aa84fc406708cd8dc1b1d60e7f27cea685
|
||||
F test/select4.test 1ae6f2bd6177d4428df8644eb95d09f4568fb149
|
||||
@ -269,7 +269,7 @@ F www/tclsqlite.tcl e73f8f8e5f20e8277619433f7970060ab01088fc
|
||||
F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618
|
||||
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
|
||||
F www/whentouse.tcl c3b50d3ac31c54be2a1af9b488a89d22f1e6e746
|
||||
P 0142ae6f0004bf18a1c2d8e49c09d2a9a27d6369
|
||||
R b2406c5f3bd45a3ced07f6eb72e28967
|
||||
P 88d4834fec7583a9b6400a1ce5b928c1f8a390dd
|
||||
R b82899e5e20c2e403cd6bfa3ba754b75
|
||||
U drh
|
||||
Z 4a32c7e963fbc8acd621a17d2d1e7a76
|
||||
Z fb3a884afe1488504ff81cd6dd7f3e7e
|
||||
|
@ -1 +1 @@
|
||||
88d4834fec7583a9b6400a1ce5b928c1f8a390dd
|
||||
9295050af1bf2d9d4dc63adc225a2848d67cbe17
|
@ -14,7 +14,7 @@
|
||||
** other files are for internal use by SQLite and should not be
|
||||
** accessed by users of the library.
|
||||
**
|
||||
** $Id: main.c,v 1.271 2005/01/13 02:14:25 danielk1977 Exp $
|
||||
** $Id: main.c,v 1.272 2005/01/18 16:02:40 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@ -1111,7 +1111,7 @@ static int openDatabase(
|
||||
db->aDb = db->aDbStatic;
|
||||
db->enc = SQLITE_UTF8;
|
||||
db->autoCommit = 1;
|
||||
/* db->flags |= SQLITE_ShortColNames; */
|
||||
db->flags |= SQLITE_ShortColNames;
|
||||
sqlite3HashInit(&db->aFunc, SQLITE_HASH_STRING, 0);
|
||||
sqlite3HashInit(&db->aCollSeq, SQLITE_HASH_STRING, 0);
|
||||
for(i=0; i<db->nDb; i++){
|
||||
|
@ -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.225 2005/01/18 14:45:48 drh Exp $
|
||||
** $Id: select.c,v 1.226 2005/01/18 16:02:40 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@ -757,7 +757,7 @@ static void generateColumnNames(
|
||||
if( iCol<0 ) iCol = pTab->iPKey;
|
||||
assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
|
||||
if( iCol<0 ){
|
||||
zCol = "_ROWID_";
|
||||
zCol = "rowid";
|
||||
}else{
|
||||
zCol = pTab->aCol[iCol].zName;
|
||||
}
|
||||
@ -772,7 +772,7 @@ static void generateColumnNames(
|
||||
sqlite3SetString(&zName, zTab, ".", zCol, 0);
|
||||
sqlite3VdbeSetColName(v, i, zName, P3_DYNAMIC);
|
||||
}else{
|
||||
sqlite3VdbeSetColName(v, i, zCol, 0);
|
||||
sqlite3VdbeSetColName(v, i, zCol, strlen(zCol));
|
||||
}
|
||||
}else if( p->span.z && p->span.z[0] ){
|
||||
sqlite3VdbeSetColName(v, i, p->span.z, p->span.n);
|
||||
|
@ -12,7 +12,7 @@
|
||||
#
|
||||
# This file implements tests for joins, including outer joins.
|
||||
#
|
||||
# $Id: join.test,v 1.13 2004/11/22 13:35:42 danielk1977 Exp $
|
||||
# $Id: join.test,v 1.14 2005/01/18 16:02:40 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -40,32 +40,32 @@ do_test join-1.3 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 NATURAL JOIN t2;
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.d 5}
|
||||
} {a 1 b 2 c 3 d 4 a 2 b 3 c 4 d 5}
|
||||
do_test join-1.3.1 {
|
||||
execsql2 {
|
||||
SELECT * FROM t2 NATURAL JOIN t1;
|
||||
}
|
||||
} {t2.b 2 t2.c 3 t2.d 4 t1.a 1 t2.b 3 t2.c 4 t2.d 5 t1.a 2}
|
||||
} {b 2 c 3 d 4 a 1 b 3 c 4 d 5 a 2}
|
||||
do_test join-1.4 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 INNER JOIN t2 USING(b,c);
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.d 5}
|
||||
} {a 1 b 2 c 3 d 4 a 2 b 3 c 4 d 5}
|
||||
do_test join-1.5 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 INNER JOIN t2 USING(b);
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.c 3 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.c 4 t2.d 5}
|
||||
} {a 1 b 2 c 3 c 3 d 4 a 2 b 3 c 4 c 4 d 5}
|
||||
do_test join-1.6 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 INNER JOIN t2 USING(c);
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.b 2 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.b 3 t2.d 5}
|
||||
} {a 1 b 2 c 3 b 2 d 4 a 2 b 3 c 4 b 3 d 5}
|
||||
do_test join-1.7 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 INNER JOIN t2 USING(c,b);
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.d 5}
|
||||
} {a 1 b 2 c 3 d 4 a 2 b 3 c 4 d 5}
|
||||
|
||||
do_test join-1.8 {
|
||||
execsql {
|
||||
@ -97,13 +97,13 @@ do_test join-1.13 {
|
||||
SELECT * FROM t1 NATURAL JOIN
|
||||
(SELECT b as 'c', c as 'd', d as 'e' FROM t2) as t3
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t3.d 4 t3.e 5}
|
||||
} {a 1 b 2 c 3 d 4 e 5}
|
||||
do_test join-1.14 {
|
||||
execsql2 {
|
||||
SELECT * FROM (SELECT b as 'c', c as 'd', d as 'e' FROM t2) as 'tx'
|
||||
NATURAL JOIN t1
|
||||
}
|
||||
} {tx.c 3 tx.d 4 tx.e 5 t1.a 1 t1.b 2}
|
||||
} {c 3 d 4 e 5 a 1 b 2}
|
||||
|
||||
do_test join-1.15 {
|
||||
execsql {
|
||||
@ -123,7 +123,7 @@ do_test join-1.17 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 natural join t2 natural join t3;
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t3.e 5 t1.a 2 t1.b 3 t1.c 4 t2.d 5 t3.e 6}
|
||||
} {a 1 b 2 c 3 d 4 e 5 a 2 b 3 c 4 d 5 e 6}
|
||||
do_test join-1.18 {
|
||||
execsql {
|
||||
CREATE TABLE t4(d,e,f);
|
||||
@ -133,16 +133,16 @@ do_test join-1.18 {
|
||||
SELECT * FROM t4;
|
||||
}
|
||||
} {2 3 4 3 4 5 4 5 6}
|
||||
do_test join-1.19 {
|
||||
do_test join-1.19.1 {
|
||||
execsql {
|
||||
SELECT * FROM t1 natural join t2 natural join t4;
|
||||
}
|
||||
} {1 2 3 4 5 6}
|
||||
do_test join-1.19 {
|
||||
do_test join-1.19.2 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 natural join t2 natural join t4;
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t4.e 5 t4.f 6}
|
||||
} {a 1 b 2 c 3 d 4 e 5 f 6}
|
||||
do_test join-1.20 {
|
||||
execsql {
|
||||
SELECT * FROM t1 natural join t2 natural join t3 WHERE t1.a=1
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the SELECT statement.
|
||||
#
|
||||
# $Id: select1.test,v 1.38 2005/01/15 01:52:33 drh Exp $
|
||||
# $Id: select1.test,v 1.39 2005/01/18 16:02:41 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -438,7 +438,7 @@ do_test select1-6.7 {
|
||||
set v [catch {execsql2 {SELECT A.f1, t1 FROM test1 as A, test2
|
||||
ORDER BY f2}} msg]
|
||||
lappend v $msg
|
||||
} {0 {A.f1 11 t1 abc A.f1 33 t1 abc}}
|
||||
} {0 {f1 11 t1 abc f1 33 t1 abc}}
|
||||
do_test select1-6.8 {
|
||||
set v [catch {execsql2 {SELECT A.f1, f1 FROM test1 as A, test1 as B
|
||||
ORDER BY f2}} msg]
|
||||
@ -454,11 +454,16 @@ do_test select1-6.8c {
|
||||
ORDER BY f2}} msg]
|
||||
lappend v $msg
|
||||
} {1 {ambiguous column name: A.f1}}
|
||||
do_test select1-6.9 {
|
||||
do_test select1-6.9.1 {
|
||||
set v [catch {execsql {SELECT A.f1, B.f1 FROM test1 as A, test1 as B
|
||||
ORDER BY A.f1, B.f1}} msg]
|
||||
lappend v $msg
|
||||
} {0 {11 11 11 33 33 11 33 33}}
|
||||
do_test select1-6.9.2 {
|
||||
set v [catch {execsql2 {SELECT A.f1, B.f1 FROM test1 as A, test1 as B
|
||||
ORDER BY A.f1, B.f1}} msg]
|
||||
lappend v $msg
|
||||
} {0 {A.f1 11 B.f1 11 A.f1 11 B.f1 33 A.f1 33 B.f1 11 A.f1 33 B.f1 33}}
|
||||
} {0 {f1 11 f1 11 f1 33 f1 33 f1 11 f1 11 f1 33 f1 33}}
|
||||
|
||||
ifcapable compound {
|
||||
do_test select1-6.10 {
|
||||
@ -641,16 +646,16 @@ do_test select1-11.1 {
|
||||
SELECT * FROM t3, t4;
|
||||
}
|
||||
} {1 2 3 4}
|
||||
do_test select1-11.2 {
|
||||
do_test select1-11.2.1 {
|
||||
execsql {
|
||||
SELECT * FROM t3, t4;
|
||||
}
|
||||
} {1 2 3 4}
|
||||
do_test select1-11.2.2 {
|
||||
execsql2 {
|
||||
SELECT * FROM t3, t4;
|
||||
}
|
||||
} {t3.a 1 t3.b 2 t4.a 3 t4.b 4}
|
||||
do_test select1-11.3 {
|
||||
execsql2 {
|
||||
SELECT * FROM t3 AS x, t4 AS y;
|
||||
}
|
||||
} {x.a 1 x.b 2 y.a 3 y.b 4}
|
||||
} {a 3 b 4 a 3 b 4}
|
||||
do_test select1-11.4.1 {
|
||||
execsql {
|
||||
SELECT t3.*, t4.b FROM t3, t4;
|
||||
@ -661,16 +666,16 @@ do_test select1-11.4.2 {
|
||||
SELECT "t3".*, t4.b FROM t3, t4;
|
||||
}
|
||||
} {1 2 4}
|
||||
do_test select1-11.5 {
|
||||
do_test select1-11.5.1 {
|
||||
execsql2 {
|
||||
SELECT t3.*, t4.b FROM t3, t4;
|
||||
}
|
||||
} {t3.a 1 t3.b 2 t4.b 4}
|
||||
} {a 1 b 4 b 4}
|
||||
do_test select1-11.6 {
|
||||
execsql2 {
|
||||
SELECT x.*, y.b FROM t3 AS x, t4 AS y;
|
||||
}
|
||||
} {x.a 1 x.b 2 y.b 4}
|
||||
} {a 1 b 4 b 4}
|
||||
do_test select1-11.7 {
|
||||
execsql {
|
||||
SELECT t3.b, t4.* FROM t3, t4;
|
||||
@ -680,12 +685,12 @@ do_test select1-11.8 {
|
||||
execsql2 {
|
||||
SELECT t3.b, t4.* FROM t3, t4;
|
||||
}
|
||||
} {t3.b 2 t4.a 3 t4.b 4}
|
||||
} {b 4 a 3 b 4}
|
||||
do_test select1-11.9 {
|
||||
execsql2 {
|
||||
SELECT x.b, y.* FROM t3 AS x, t4 AS y;
|
||||
}
|
||||
} {x.b 2 y.a 3 y.b 4}
|
||||
} {b 4 a 3 b 4}
|
||||
do_test select1-11.10 {
|
||||
catchsql {
|
||||
SELECT t5.* FROM t3, t4;
|
||||
@ -700,27 +705,27 @@ do_test select1-11.12 {
|
||||
execsql2 {
|
||||
SELECT t3.* FROM t3, (SELECT max(a), max(b) FROM t4)
|
||||
}
|
||||
} {t3.a 1 t3.b 2}
|
||||
} {a 1 b 2}
|
||||
do_test select1-11.13 {
|
||||
execsql2 {
|
||||
SELECT t3.* FROM (SELECT max(a), max(b) FROM t4), t3
|
||||
}
|
||||
} {t3.a 1 t3.b 2}
|
||||
} {a 1 b 2}
|
||||
do_test select1-11.14 {
|
||||
execsql2 {
|
||||
SELECT * FROM t3, (SELECT max(a), max(b) FROM t4) AS 'tx'
|
||||
}
|
||||
} {t3.a 1 t3.b 2 tx.max(a) 3 tx.max(b) 4}
|
||||
} {a 1 b 2 max(a) 3 max(b) 4}
|
||||
do_test select1-11.15 {
|
||||
execsql2 {
|
||||
SELECT y.*, t3.* FROM t3, (SELECT max(a), max(b) FROM t4) AS y
|
||||
}
|
||||
} {y.max(a) 3 y.max(b) 4 t3.a 1 t3.b 2}
|
||||
} {max(a) 3 max(b) 4 a 1 b 2}
|
||||
do_test select1-11.16 {
|
||||
execsql2 {
|
||||
SELECT y.* FROM t3 as y, t4 as z
|
||||
}
|
||||
} {y.a 1 y.b 2}
|
||||
} {a 1 b 2}
|
||||
|
||||
# Tests of SELECT statements without a FROM clause.
|
||||
#
|
||||
@ -785,7 +790,7 @@ do_test select1-12.10 {
|
||||
SELECT a,b FROM t3 UNION SELECT a AS 'x', b AS 'y' FROM t4 ORDER BY a,b
|
||||
) AS 'z' ORDER BY x;
|
||||
}
|
||||
} {z.x 1 z.x 3}
|
||||
} {x 1 x 3}
|
||||
} ;# ifcapable compound
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user