You can use nullif
which returns null if both values match, otherwise it returns the first value.
select some_int, nullif(some_int, 0), some_text, nullif(some_text, '0')from some_table
nullif
is specific to your problem. More generically you'd use a case
.
select some_int, case some_int when 0 then null else some_int end as "case", some_text, case some_text when '0' then null else some_text end as "case"from some_table;