Comments - Generated (Virtual and Persistent/Stored) Columns
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
Computed columns can only come from static, deterministic values.
You may find that "unfortunate," but I am having trouble understanding your desired semantics.
Do you intend the value of your expression to be frozen upon first evaluation, or rather to be updated (with NOW()) on every access?
The former can be done with a function or a simple UPDATE statement. The latter would seem to be quite costly.
One can only imagine the overhead involved in allowing computed columns to be made up of Any Damn Thing™ one wanted to have there. Should RAND() be allowed, for example?
PERSISTENTcolumns non-deterministic expressions of course are meaningless. For
VIRTUALcolumns it could make sense. Though, it would be the same as
SELECTwith explicitly written expression. So yes, that my post is stupid.