Richard, Thank you for your answer. Datatypes in sqlite was always weird for me, mostly the fact that for example TEXT can be inserted in INTEGER column.
In this case I think that the best way to do this is cast integer column to text. CREATE VIEW id_map(id, name) as SELECT CAST(id AS TEXT), name FROM map_integer UNION ALL SELECT id, name FROM map_text; Is there any other recipe to do this? Is there any documentation when '4'==4 (just to satisfy my curiosity)? I've read https://www.sqlite.org/datatype3.html, but from this doc I was quite sure that comparing text and integer columns is safe. -- Adrian Stachlewski 2016-12-22 16:06 GMT+01:00 Richard Hipp <d...@sqlite.org>: > Adrian: > > String are not equal to numbers. You should not expect that '4'==4. > Yes, I know that SQLite will sometimes do this. The complex type > coercion rules were added so that SQL scripts that worked on > PostgreSQL would also work on SQLite. But really, you should avoid > depending on automatic type coercion. If you are having to think > about the type coercion rules, then you are doing it wrong. > > Yes - SQLite should give consistent and predictable answers. We will > fix that. Eventually. Once I figure out what it ought to be doing. > But you should not wait on that fix. You should go ahead redesign > your application so that it does not depend on the nuances of type > coercions and so that it does not compare strings against integers and > expect them to be equal. > -- > D. Richard Hipp > d...@sqlite.org > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users