The "data type" is associated with the data value itself. Columns do not have Datatypes -- they have affinities. The column affinity is only used when doing certain and specific operations on real tables. Since you cannot do these operations on a view, the column affinity is meaningless and is just a comment. You can create these comments for views, however, if you declare the view such that it includes them (ie, just as you would declare a table). However, if you use a shortcut method to declare a view, then the comments are left out simply beause to compute them would serve no purpose, and having them provides no advantage.
> -----Original Message----- > From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users- > bounces at mailinglists.sqlite.org] On Behalf Of Alan Bryan > Sent: Saturday, 30 May, 2015 19:22 > To: sqlite-users at mailinglists.sqlite.org > Subject: [sqlite] Possible Bug > > I am running into an issue with SQLite that I think might be a bug. When I > run the PRAGMA table_info > <http://t.signauxcinq.com/e1t/c/5/f18dQhb0S7lC8dDMPbW2n0x6l2B9nMJN7t5XZsRz > DgTW5vwkZs8pTgPFVRbxS056dNRVf9jsl6n02?t=https%3A%2F%2Fwww.sqlite.org%2Fpra > gma.html%23pragma_table_info&si=5896992917028864&pi=edf25f00-c978-4b44- > 96cc-867a8bd93485> > command > on a view that uses an aggregate function, the data type always comes up > empty. > > To duplicate the issue, create a new SQLite 3 database and add a table. > Add > at least one field in the table and make sure its a numeric field (such as > integer or float or something). Then create a new view with a SELECT > statement > similar to the following: > > SELECT *, Sum(MyField) AS MySumField FROM MyTable > > Now run sqlite3 <database_name> and type the following: > > PRAGMA table_info(MyView); > > You will notice there is no data type for some reason. Here is my output > when I issued the command: > > 0|Field1|INTEGER|0||01|Field2|INTEGER|0||02|Field3|FLOAT|0||03|SumField2|| > 0||0 > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users