I'd say this is definitely a bug. Especially keeping in mind that it's not affinity that changed it's actual datatype of returning value. It's interesting though that affinity for the value remains TEXT and comparison is performed as for text:
sqlite> create table t1(a text, b int); sqlite> insert into t1 values(123, 456); sqlite> select typeof(a), a from t1; text|123 sqlite> select typeof(a), a from t1 group by a; text|123 sqlite> select typeof(a), a from t1 group by a having a=123; text|123 sqlite> select typeof(a), a from t1 group by a having a='123'; text|123 sqlite> select typeof(a), a from t1 group by a having a<b; integer|123 sqlite> select typeof(a), a, a<1222, a>1222, b<4555 from t1 group by a having a<b; integer|123|0|1|1 Pavel On Tue, Mar 2, 2010 at 11:33 AM, <wcl...@gfs-hofheim.de> wrote: > Hi, > > I think I may have found a bug where affinities change through the HAVING > expression. For example, under v3.6.22, if I do... > > create table t1(a text, b int); > insert into t1 values(123, 456); > select typeof(a), a from t1 group by a having a<b; > > then I get "integer|123" when I would expect "text|123" > > If, instead, I do... > > select typeof(a), a from t1 group by a having a=123; > or... > select typeof(a), a from t1 group by a having a='123'; > > then I get "text|123" as expected (note: this was previously fixed under > ticket #3493 at http://www.sqlite.org/cvstrac/tktview?tn=3493). > > Can anyone confirm that this is indeed a bug? I've not provided the sql > statement I'm trying to run, but instead created a set of statements to > match the style used in tkt3493.test to better isolate the problem as I > see it. I trust this is more helpful. > > Thanks > Will > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users