Jose Isaias Cabrera, on Thursday, October 10, 2019 08:55 AM, wrote...
> Simon Charette, on Tuesday, October 8, 2019 08:00 PM, wrote...
> >
> > While trying to enable support for FILTER (WHERE) on SQLite 3.30 for
> > the Django ORM we discovered a crash that can be reduced to the
> > following
> >
> > sqlite> CREATE TABLE item (id int, price int);
> > sqlite> INSERT INTO item (id, price) VALUES (1, 1);
> > sqlite> SELECT COUNT(id) FILTER (WHERE double_price > 42) FROM (SELECT
> > id, (price * 2) as double_price FROM item);
> > Erreur de segmentation (core dumped)
>
> I get this,
>
> sqlite> CREATE TABLE item (id int, price int);
> sqlite>  INSERT INTO item (id, price) VALUES (1, 1);
> sqlite>  SELECT COUNT(id) FILTER (WHERE double_price > 42) FROM (SELECT
>    ...> id, (price * 2) as double_price FROM item);
> Error: near "FROM": syntax error
>
> why don't you just do the simpler,
>
> sqlite> select count(id) from item where price * 2 > 42;
> 0
> sqlite> select count(id) from item where price * 2 > 1;
> 1
>
> I know, because you are probably trying to use that FILTER thingy. :-)  
> Thanks.

I am sorry, Simon. You are correct.  In Windows sqlite3 just disappears. :-)

 9:00:24.34>sqlite3
SQLite version 3.30.0 2019-10-04 15:03:17
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> CREATE TABLE item (id int, price int);
sqlite> INSERT INTO item (id, price) VALUES (1, 1);
sqlite> SELECT COUNT(id) FILTER (WHERE double_price > 42) FROM (SELECT
   ...> id, (price * 2) as double_price FROM item);

 9:03:13.72>

So, there is a problem with FILTER and v3.30.0.  Apologies.  I was using 3.29.0.

josé
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to