WL#411: Generated columns

Affects: Server-5.7   —   Status: Complete

The goal of this WL is to add support for Generated Columns (GC). Value of such
column, unlike regular field's value, isn't set by the user, but computed
from the expression given by user at the time GC is created.

For example, if you have  FirstName and SecondName columns,   
you may add a computed column FullName as CONCAT(FirstName," ",SecondName).  

There are two types of generated columns - stored and virtual. Values for
former is computed only once, when a new record is inserted or old one is
updated. After computing the value is stored in the table in exactly the
same way as a value for a regular field. Values for latter aren't stored at
all, but computed each time when server reads a record from the table.
User-specified values can't be inserted into GCs. Stored GCs could be a
part of index(es), while non-stored - can't.

This feature could be used in several ways. The virtual GCs could be
used as a way to simplify and unify queries. This way a complicated
condition could be saved as a GC and then used as a field in a set of queries
to ensure that all of them use exactly the same condition.
Stored GCs could be used as a materialized cache for complicated conditions
that are costly to calculate on the fly. Another use for stored GCs is a
workaround for lack of functional indexes. This way user have to create a
stored GC using required functional expression and then define a
secondary index over it. Disadvantage of such approach is that values are stored 
twice - first time in the table as the value of GC and the second time in the 
index. True functional index would store data only once.