On 06/09/18 20:10, Simon Slavin wrote:
On 10 Jun 2018, at 2:00am, Andy Goth <[email protected]> wrote:CREATE TABLE tempLog ( datestamp TEXT COLLATE NOCASE PRIMARY KEY , centTemp REAL); CREATE VIEW tempLogView AS SELECT * , centTemp * 9 / 5 + 32 AS fahrTemp FROM tempLog;Yes. That is an elegant and compact way to do it with SQLite as it is now. But it's not as satisfying. And it doesn't allow indexing by the computed column. You have to define the calculation in the index separately.
However, views make behavior of INSERT and UPDATE clear, since they can only operate on the real table. INSERT or UPDATE become murky when in the presence of computed columns. I suppose the only sane thing to do is forbid directly setting the value of a computed column, though what would the syntax be? Skip computed columns in the value list? If two tables have the same schema, this should duplicate one into the other, but apparently not: INSERT INTO table2 SELECT * from table1; -- Andy Goth | <andrew.m.goth/at/gmail/dot/com> _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

