Why is the below code not valid. I have only used immutable columns. Below code is supposed to add a new column to the users table. There are few conditions that needs to meet for the is_valid column to be true else it will be false. The email and legacy_password columns must not be null or empty. And expiry_date must not be passed.
ALTER TABLE IF EXISTS vnext.users
ADD COLUMN is_valid boolean GENERATED ALWAYS AS
((
Case when (((trim(coalesce(email,'')) <> '') IS NOT False)
AND ((trim(coalesce(legacy_password,'')) <> '') IS NOT False)
AND (Case WHEN expiry_date is null Then True ELSE date_trunc('day',
expiry_date)>date_trunc('day', current_timestamp) END)) THEN TRUE ELSE FALSE END
)) STORED;