SQLite Forum

Potential bug? = comparison on columns defined with no type
Login
I ran into this while working with the [parlgov-development.db](http://www.parlgov.org/static/data/parlgov-development.db) (<- download link) database from [http://www.parlgov.org/](http://www.parlgov.org/)


If you create a table where the columns do not have types (which isn't something I would ever do, but I write software that works with databases created by other people) the following SQL queries return different results:

    select * from no_column_types where country_id = 44;

Compared to:

    select * from no_column_types where country_id = '44';

Here's a full demonstration session:

    SQLite version 3.28.0 2019-04-15 14:49:49
    sqlite> create table no_column_types (id, name, country_id);
    sqlite> insert into no_column_types (id, name, country_id) values (1, 'Bob', 44);
    sqlite> insert into no_column_types (id, name, country_id) values (2, 'Karl', 44);
    sqlite> select * from no_column_types;
    1|Bob|44
    2|Karl|44
    sqlite> select * from no_column_types where country_id = 44;
    1|Bob|44
    2|Karl|44
    sqlite> select * from no_column_types where country_id = '44';
    sqlite> 

Is this a SQLite bug, or is this intended behaviour?

Here's a full issue thread where I explore this bug: [Figure out why an {eq: value} fails where where: "x = value" succeeds](https://github.com/simonw/datasette-graphql/issues/43)