This has been driving me crazy for a few days now. I am using sqlite3 however I have also found this to be the case with 2.8.15: I have data types text or integer on every column of every table in the database. Now i know sqlite doesnt care much about data types, but I believe rails does (correct me if im wrong). On pages that query a table, everything is perfect. BUT when I use a view instead of a table everything goes down the tubes. I get 0.0''s for where text should be and all kinds of stuff breaks. I looked into the log and saw that rails did: PRAGMA table_info(my view) So I did that myself to see the results: ALL NUMERIC So I check an actual table: text and integers as it should be. My guess is the problem is in sqlite itself... views dont inherit the correct types of the table data they contain. Then I am guessing activerecord converts everything to a number like the incorrect table_info shows. Id really appreciate any info anyone may have on this. It seems hard for me to believe I am the only person to come across this but I have searched all over and cant find anything related to this problem. --joe
Joe Noon wrote:>So I did that myself to see the results: ALL NUMERIC > >The table_info pragma works fine with Sqlite 3.2.1. I can verify it is broken in 2.8.16, but I don''t think that will be fixed since fixed in 3.x - Adam
On 5/8/05, Adam M. <gnuman1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Joe Noon wrote: > > >So I did that myself to see the results: ALL NUMERIC > > > > > The table_info pragma works fine with Sqlite 3.2.1. I can verify it is > broken in 2.8.16, but I don''t think that will be fixed since fixed in 3.x >I was able to get 3.2.1 installed and all data types are now fine in views. Thank you for your help. One funny thing about sqlite and views is that you cant access a column unless you give it a specific name... for example: if your view is like: select users.id, user_details.name ..... blah .... select * from myview where users.id = 4 < no such column users.id or where id = 4 < no such column id but if your view is like: select users.id AS id, user_details.name AS name ..... blah .... select * from myview where id = 4 < works fine Strange thing this sqlite is :) --Joe
Joe Noon wrote:>Strange thing this sqlite is :) > >There are bugs in SQLite. You can live with them, report a bug and wait for a fix or fix it yourself. It is a very good embedded database though. I find it much easier to use than a lot of other, embedded databases. And best of all, it is 100% free. - Adam