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