title: postgresql, generated fields from jsonb
body: <p>I'm using a generated column with postgresql 12 with data from a jsonb field (containing a json with <code>"public":true</code> or <code>"public":false</code></p>
  
  <pre><code>CREATE TABLE people (
      ...,
      data jsonb,
      public boolean generated always as ((data -&gt;&gt; 'public')::boolean) stored,
      ...
  )
  </code></pre>
  
  <p>sometimes the json (coming from different applications) is missing the <strong>public</strong> key. how i can set a default to FALSE to public column?</p>