Re: INSERT OR UPDATE?

From: "shakahshakah(at)gmail(dot)com" <shakahshakah(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: INSERT OR UPDATE?
Date: 2005-10-09 09:32:49
Message-ID: 1128850369.503864.140430@g44g2000cwa.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron Mayer 2005-10-09 10:05:48 Tsearch & functional indexes
Previous Message Gregory Youngblood 2005-10-09 09:08:55 PostgreSQL missing in SuSE 10?