On 1/31/20, Markus Winand <markus.win...@winand.at> wrote: > > - Expressions also have a declared type. More elaborate: the result value of > an expression has a type that is statically determined (again the “declared > type”).
SQLite is a generalization of "Standard SQL" that allows expressions that can have an arbitrary type. Some (most?) expressions in SQLite will always return the same type, but it is not hard to construct an SQLite expression that returns different types based on its inputs. You can also create application-defined functions including table-valued functions that return different types based on their inputs. Internally, SQLite makes no attempt to track the datatype of an expression. Such tracking could be added, but doing so would just make the library bigger and slower without serving any useful purpose. > > - If a generated column doesn’t have an explicit data type mentioned, the > the data type of the result of the expression is used. Having no explicit data type is a kind of explicit data type in SQLite, since any SQLite column (generated or otherwise) can omit the data type specification and the data type affinity becomes the equivalent of "ANY". From that point of view, SQLite is like PG in that it requires an explicit data type on generated columns, though SQLite extends PG by allowing that explicit data type to be the unnamed "ANY" data type. And since the data type is always implicit in the column definition, there is never an occasion to inherit the data type from the AS expression. Furthermore, SQLite expressions do not have data types, so even if a generated column were said to omit the data type, there would be no way of capturing it from the AS expression. -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users