On 2019-10-30 12:02 p.m., Simon Slavin wrote:
On 30 Oct 2019, at 6:56pm, Darren Duncan <dar...@darrenduncan.net> wrote:
"Generated columns may not be used as part of the PRIMARY KEY. (Future versions of
SQLite might relax this constraint for STORED columns.)"
Replace with this:
"VIRTUAL generated columns may not be used as part of the PRIMARY KEY."
What happens if the generated column is based on a calculation including rowid
? At the time the values are calculated, rowid might not yet be known.
I suggest one option is adding a restriction that rowid may not be used directly
or indirectly in a STORED generated column and only in a VIRTUAL one.
Alternately, a longer term solution would be generate rowid as an independent
prior step. Like explicitly calling a sequence generator in one step and then
using that as a then-constant input in composing the row.
While I can think of numerous uses of a stored generated column based on
user-supplied values, I can't think of any use case for a generated column based
on a rowid.
One way or another I believe this is surmountable and stored generated columns
in a primary key is worth it.
-- Darren Duncan
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users