CREATE TABLE ... AS ... uses short names for columns. Ticket #1036. (CVS 2232)

FossilOrigin-Name: b1d4c42d2be07adda68d31c570ba7cf8b115c3ad
This commit is contained in:
drh
2005-01-18 17:20:10 +00:00
parent 47a6db2bfd
commit 79d5f63fa2
6 changed files with 70 additions and 29 deletions
+24 -1
View File
@@ -13,7 +13,7 @@
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc4.test,v 1.10 2005/01/18 14:45:49 drh Exp $
# $Id: misc4.test,v 1.11 2005/01/18 17:20:10 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -119,4 +119,27 @@ do_test misc4-4.1 {
}
} {01 data01 01 3.0 +1 data+1 +1 7.0}
# Ticket #1036. When creating tables from a SELECT on a view, use the
# short names of columns.
#
do_test misc4-5.1 {
execsql {
create table t4(a,b);
create table t5(a,c);
insert into t4 values (1,2);
insert into t5 values (1,3);
create view myview as select t4.a a from t4 inner join t5 on t4.a=t5.a;
create table problem as select * from myview;
}
execsql2 {
select * FROM problem;
}
} {a 1}
do_test misc4-5.2 {
execsql2 {
create table t6 as select * from t4, t5;
select * from t6;
}
} {a 1 b 2 a:1 1 c 3}
finish_test
+3 -3
View File
@@ -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.39 2005/01/18 16:02:41 drh Exp $
# $Id: select1.test,v 1.40 2005/01/18 17:20:10 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -385,12 +385,12 @@ do_test select1-6.1.2 {
do_test select1-6.1.3 {
set v [catch {execsql2 {SELECT * FROM test1 WHERE f1==11}} msg]
lappend v $msg
} {0 {test1.f1 11 test1.f2 22}}
} {0 {f1 11 f2 22}}
do_test select1-6.1.4 {
set v [catch {execsql2 {SELECT DISTINCT * FROM test1 WHERE f1==11}} msg]
execsql {PRAGMA full_column_names=off}
lappend v $msg
} {0 {test1.f1 11 test1.f2 22}}
} {0 {f1 11 f2 22}}
do_test select1-6.1.5 {
set v [catch {execsql2 {SELECT * FROM test1 WHERE f1==11}} msg]
lappend v $msg