We had a latent bug about an invalid view hiding in our code, which was
recently revealed when we upgraded SQLite to 3.7.16.2 (I test with 1.15.2
below, but that's the same).

I guess that's good, thanks Richard :)

But that brings up the question about why the create view itself does not
fail?

Thanks, --DD

C:\Users\DDevienne>sqlite3
SQLite version 3.7.15.2 2013-01-09 11:53:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table a (b int primary key, c);
sqlite> create table d (e int primary key, f, g);
sqlite> create view v as select * from a union all select * from d;
sqlite> select * from v;
Error: SELECTs to the left and right of UNION ALL do not have the same
number of result columns
sqlite> explain select rowid from v;
Error: SELECTs to the left and right of UNION ALL do not have the same
number of result columns
sqlite> .q

C:\Users\DDevienne>sqlite3.7.8
SQLite version 3.7.8 2011-09-19 14:49:19
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table a (b int primary key, c);
sqlite> create table d (e int primary key, f, g);
sqlite> create view v as select * from a union all select * from d;
sqlite> select * from v;
sqlite> explain select rowid from v;
0|Trace|0|0|0||00|
1|Goto|0|15|0||00|
2|OpenRead|2|2|0|2|00|
3|Rewind|2|7|0||00|
4|Null|0|1|0||00|
5|ResultRow|1|1|0||00|
6|Next|2|4|0||01|
7|Close|2|0|0||00|
8|OpenRead|1|4|0|3|00|
9|Rewind|1|13|0||00|
10|Null|0|1|0||00|
11|ResultRow|1|1|0||00|
12|Next|1|10|0||01|
13|Close|1|0|0||00|
14|Halt|0|0|0||00|
15|Transaction|0|0|0||00|
16|VerifyCookie|0|3|0||00|
17|TableLock|0|2|0|a|00|
18|TableLock|0|4|0|d|00|
19|Goto|0|2|0||00|
sqlite> .q
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to