0

I was trying to generate a computed column in SQLite and using this example as a reference. https://sqlite.org/gencol.html

CREATE TABLE t1
(
   a INTEGER PRIMARY KEY,
   b INT,
   c TEXT,
   d INT GENERATED ALWAYS AS (a*abs(b)) VIRTUAL,
   e TEXT GENERATED ALWAYS AS (substr(c,b,b+1)) STORED
);

I am working with SQLite 3.33.0 and it should be working perfectly fine in this version of SQLite.

Yet, when I try to implement it, I get the following:

Error while executing SQL query on database 'Test': near "AS": syntax error

What am I missing?

Thanks for your help in advance. T.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
stoltm
  • 1
  • 1
  • Generated columns are supported since version 3.31.0 of SQLite. Check your version. – forpas Oct 14 '20 at 08:28
  • @forpas, I am working iwht SQLite 3.33.0 and SQLiteStudio-3.2.1. – stoltm Oct 14 '20 at 09:03
  • As far as I knoe SQLiteStudio-3.2.1 uses SQLite 3.24.0. Execute `select sqlite_version();` to recheck. I tested your code in DB Browser for SQLite 3.12.0 which uses SQLite 3.32.0 and it works fine. – forpas Oct 14 '20 at 09:26
  • 1
    Okay, sorry. My bad. With the latest version of DB Browser it is working. Thanks @forpas. – stoltm Oct 14 '20 at 10:34

0 Answers0