Re: 'UPDATE OR INSERT' command

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Jeff Kowalczyk <jtk(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: 'UPDATE OR INSERT' command
Date: 2004-07-15 17:49:32
Message-ID: 20040715174932.GS21419@ns.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

* Jeff Kowalczyk (jtk(at)yahoo(dot)com) wrote:
> Is there a postgresql SQL idiom to perform an UPDATE, which becomes an
> INSERT if the primary key does not exist?
>
> I'm not sure I *should* use it in my application, I just want to know if
> it can be done. Thanks.

Unfortunately, I don't believe there's one in PostgreSQL yet. MERGE is
similar to this, and is defined in the latest SQL spec. Hopefully it'll
be implemented in PostgreSQL sometime soon.

Stephen

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2004-07-15 17:53:18 Re: 'UPDATE OR INSERT' command
Previous Message SZUCS Gábor 2004-07-15 14:29:17 Re: How do I convice postgres to use an index?