Sorry, I didn't read your code carefully enough the first time.
Your approach won't work because origin has no explicit type,
and SQLite will not infer a type from the literal string; the
unknown type defaults to numeric.

As Dennis said, the problem is really with RoR, but you can
work around it by creating two 1-row, 1-column tables. Here's
the idea; this is more or less the A part of your view, so
you'll have to add the union and the B part.

sqlite> pragma table_info(t1);
cid         name        type        notnull     dflt_value  pk        
----------  ----------  ----------  ----------  ----------  ----------
0           a           integer     0           <>          1         
1           c           char        0           <>          0         
sqlite> create temp table originA (a char);
sqlite> insert into originA values ('a');
sqlite> create temp view va as select t1.*, originA.a origin from t1, originA;
sqlite> pragma table_info(va);
cid         name        type        notnull     dflt_value  pk        
----------  ----------  ----------  ----------  ----------  ----------
0           a           integer     0           <>          0         
1           c           char        0           <>          0         
2           origin      char        0           <>          0         


Regards

Reply via email to