Re: INSERT OR UPDATE? - Mailing list pgsql-general

From shakahshakah@gmail.com
Subject Re: INSERT OR UPDATE?
Date
Msg-id 1128850369.503864.140430@g44g2000cwa.googlegroups.com
Whole thread Raw
In response to Re: INSERT OR UPDATE?  (gordonb.d7t5w@burditt.org (Gordon Burditt))
List pgsql-general
Gordon Burditt wrote:
> [...stuff snipped...]
>
> MySQL permits (but it's not standard, and available in MySQL 4.1.0
> and later):
>
> INSERT INTO my.table (somefield) VALUES ('$someval') ON DUPLICATE
> KEY UPDATE somefield = '$someval';
>
> This is very useful for times when you want to count something (e.g.
> SPAM), and if a record doesn't exist, make one with a count of 1.
>
> I don't know whether something similar is available in PostGres.
>
>                     Gordon L. Burditt

In Postgres you'd probably create a server-side function to get that
effect.


pgsql-general by date:

Previous
From: "andrew"
Date:
Subject: Re: INSERT OR UPDATE?
Next
From: "Dean Gibson (DB Administrator)"
Date:
Subject: Re: INSERT OR UPDATE?