In PostgreSQL, I would like to increment a field but it is null sometimes.
How do I increment that field in 1 if it is not null and set it to 1 if it is null?
insert into table (id, inc) values('a',1) on conflict(id) do update set inc=inc;
When id already exists and inc is null it won't work.
Any suggestions?