HOWTO? if it exists, increment it, else, insert it - Mailing list pgsql-novice

From Brian Neu
Subject HOWTO? if it exists, increment it, else, insert it
Date
Msg-id 280592.60721.qm@web51912.mail.yahoo.com
Whole thread Raw
Responses Re: HOWTO? if it exists, increment it, else, insert it  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
List pgsql-novice
I can't seem to get CASE to work for me here and every example that I see is using CASE in a completely different way.

have a table:

    day(default CURRENT_DATE),   user,   count_of_a,    count_of_b

index is ("day", user)


What is the best postgres way to handle updating this table?

I basically need to say,

    if (day,user) exists, then increment count A
    else insert day, user, and count_a = 1.



thank you in advance


pgsql-novice by date:

Previous
From: "Neil Bibbins"
Date:
Subject: Windows 2K Installation difficulties...
Next
From: "A. Kretschmer"
Date:
Subject: Re: HOWTO? if it exists, increment it, else, insert it