pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Jeff Kowalczyk <jtk@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: 'UPDATE OR INSERT' command
Date: Thu, 15 Jul 2004 13:49:32 -0400
Message-ID: <20040715174932.GS21419@ns.snowman.net> (raw)
In-Reply-To: <pan.2004.07.15.18.20.54.67962@yahoo.com>
References: <pan.2004.07.15.18.20.54.67962@yahoo.com>

* Jeff Kowalczyk (jtk@yahoo.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

Attachments:

  signature.asc (application/pgp-signature, 188B) download

view thread (3+ messages)  latest in thread

Message-ID: <20040715174932.GS21419@ns.snowman.net>
Permalink:  ../20040715174932.GS21419@ns.snowman.net/
Also on:    postgresql.org/message-id/20040715174932.GS21419@ns.snowman.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sfrost@snowman.net, jtk@yahoo.com
  Subject: Re: 'UPDATE OR INSERT' command
  In-Reply-To: <20040715174932.GS21419@ns.snowman.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox