Ludwig Lim <lud_nowhere_man(at)yahoo(dot)com> writes:
> if count is zero insert else update.
Alternatively, try updating first, and if you see zero rows updated
then insert. Which one will be faster depends on whether you expect
insert or update to be the typical case.
regards, tom lane