SQLite Forum

Bug report: a bug in VIEW
Login
Hi all,

For this example:

```
CREATE TABLE t0(c0 , c1 INT);
CREATE VIEW v0(c0) AS SELECT c1 FROM t0 EXCEPT SELECT c0 FROM t0;
INSERT INTO t0 VALUES (NULL, 1);

SELECT * FROM v0; -- 1
SELECT c1 FROM t0 EXCEPT SELECT c0 FROM t0; -- 1
SELECT (c0 NOT BETWEEN '-1' AND c0) FROM v0; -- 1
SELECT * FROM v0 WHERE (c0 NOT BETWEEN '-1' AND c0); -- empty
```

I have tried to find the commit which causes this problem through bisect, but I find that it seems like this problem has been existing for a long time. Since [d794b34da6](https://sqlite.org/src/info/d794b34da6) and [bed42116ad](https://sqlite.org/src/info/bed42116ad) allowed us to use column names of a view, the problem already exists.