On 3/2/18, Olivier Mascia <[email protected]> wrote:
> is TRUE an alias to 1?

Yes.

Just to be clear, if it is possible to resolve TRUE to the name of a
column in a table, then it will refer to that column.  TRUE only
becomes an alias for 1 if there is no other way to resolve the name.
This is necessary for backwards compatibility.

So for example:

   CREATE TABLE t1(x, true, false);
   INSERT INTO t1 VALUES(1,2,2);
   SELECT * FROM t1 WHERE TRUE IS FALSE;

Non-intuitively, the last query above returns a single row.

To avoid this kind of confusion, avoid using TRUE or FALSE as the
names of columns in tables or views.
-- 
D. Richard Hipp
[email protected]
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to