[critical bug] sqlite3: col name bug on select statemnt sqlite3 --version 3.7.3
this bug occures with count or sum . -------------------------------------------------------- c:\tmp> sqlite3 test3.db .header ON -- bug drop table t1; drop table t2; drop table t3; CREATE TABLE t1 (col1 INTEGER); INSERT INTO t1 VALUES(1); CREATE TABLE t2 as select "col1" , count(*) from t1; CREATE TABLE t3 as select "col1" , sum("col1") from t1; SELECT * FROM t2; SELECT * FROM t3; SELECT [col1] FROM t2; SELECT [col1] FROM t3; .schema t2 .schema t3 --- Error: no such column: col1 --- Result : CREATE TABLE t2("""col1""" INT,"count(*)"); ---- ^^ ^^ ---- workaround : CREATE TABLE t2 as select "col1" as 'col1' , count(*) from t1; -- bug drop table t1; drop table t2; CREATE TABLE t1 ([col-1] INTEGER); CREATE TABLE t2 as select [col-1] , count(*) from t1; .schema t2 --- Result : CREATE TABLE t2("[col-1]" INT,"count(*)"); -- bug drop table t1; drop table t2; CREATE TABLE t1 ("col-1" INTEGER); CREATE TABLE t2 as select "col-1" , count(*) from t1; .schema t2 --- Result : CREATE TABLE t2("""col-1""" INT,"count(*)"); -- bug drop table t1; drop table t2; CREATE TABLE t1 ('col1' INTEGER); CREATE TABLE t2 as select "col1" , count(*) from t1; .schema t2 --- Result : CREATE TABLE t2("""col1""" INT,"count(*)"); _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users