title: Subquery as generated column in mysql?
body: <p>Can I create a generated column  in table A which sums up a column in table B with a tableA_id of the row in table A?</p>
  
  <p>Suppose I have a table of of families, and a table of children. I want a sum of the ages of the children for each family.</p>
  
  <pre><code>ALTER TABLE people.families 
  ADD COLUMN sumofages DECIMAL(10,2) GENERATED ALWAYS AS 
  (SELECT SUM(age) FROM people.children WHERE family_id = people.families.id) STORED;
  
  ERROR 3102: Expression of generated column 'sumofages' contains a disallowed function.
  </code></pre>
  
  <p>I can't save it as type VIRTUAL either. What am I doing wrong here?</p>
  
  <pre><code>ALTER TABLE people.families 
  ADD COLUMN sumofages DECIMAL(10,2) GENERATED ALWAYS AS 
  (SELECT SUM(age) FROM people.children WHERE family_id = people.families.id) VIRTUAL;
  
  ERROR 3102: Expression of generated column 'sumofages' contains a disallowed function.
  </code></pre>
  
  <p>I don't know which function is disallowed. SUM doesn't seem to be it. Maybe SELECT?</p>