https://www.postgresql.org/docs/current/ddl-generated-columns.html
https://fluca1978.github.io/2020/03/02/PostgreSQLGeneratedColumns_part2.html
https://fluca1978.github.io/2020/03/02/PostgreSQLGeneratedColumns_part2.html
ALTER TABLE sanctions_lists ADD COLUMN soundex_code varchar GENERATED ALWAYS AS ( CASE WHEN full_name is NULL THEN soundex('XXXXXXX') ELSE soundex(full_name) END ) STORED
See more from
etori.sangiacomo