I have a nullable column whose values are taken from an enum. I want to define that column's default value based on another column's value.
For example, given the following table:
name | type | status
-----|------|-------
abcd | t1 | null
efg | t2 | s1
The status column is based on an enum and can be nullable.
can I somehow define that the default value of status should be
s1 if type==t1 else null
Postgres version = 13.4