0

I try to run a query via sqflite and get the error below:

DatabaseException(no such column: true (code 1): , while compiling: select (case true WHEN true THEN 111 END) xkey1 from tb_path

Here are the SQL steps:

  1. create table tb_path(name text, age text);
  2. db.rawQuery('select (case true WHEN true THEN 111 END) xkey1 from tb_path'); and the error above showed up.

If I try to run the SQL via SqlLite Expert Personal (a windows version SQLITE tool), this works fine.

BSMP
  • 4,596
  • 8
  • 33
  • 44

1 Answers1

0

When I try your steps in sqlite command line (Ubuntu 18.04):

$ select sqlite_version();
3.22.0
$ CREATE TABLE tb_path(from_ text, to_ text);
$ select (case true WHEN true THEN 111 END) xkey1 from tb_path;
Error: no such column: true

If I try with the latest binary download (3.27), I don't get the error:

$ select sqlite_version();
3.27.2
$ CREATE TABLE tb_path(from_ text, to_ text);
$ select (case true WHEN true THEN 111 END) xkey1 from tb_path;

So maybe such statement is only valid for newer sqlite version and since sqflite uses whatever the iOS/Android platform provides, it might not be supported yet (see a good list of shipping sqlite version on Android here: Version of SQLite used in Android?)

alextk
  • 5,713
  • 21
  • 34