Skip site navigation (1) Skip section navigation (2)

Re: insert/update

From: Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com>
To: Tom Allison <tallison(at)tacocat(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: insert/update
Date: 2004-05-27 13:48:43
Message-ID: 20040527134843.82786.qmail@web20803.mail.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-general
--- Tom Allison <tallison(at)tacocat(dot)net> wrote:
> Jeff Eckermann wrote:
> > --- Tom Allison <tallison(at)tacocat(dot)net> wrote:
> > 
> >>I seemed to remember being able to do this but I
> >>can't find the docs.
> >>
> >>Can I run a sql query to insert new or update
> >>existing rows in one query?
> 
> So I have to watch out for transactions on this?
> Essentially what I'm trying to do is one of the
> following two:
> 
> if exists update a field to field+1 on one record
> if it doesn't exist, insert a row with field = 1
> 

I'm not sure what you are asking here that is not
already covered.  I suggest you spend some time
reading the documentation on concurrency, and
searching the archives for some of the lengthy past
discussions on this topic.


	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

In response to

pgsql-general by date

Next:From: Laura VanceDate: 2004-05-27 14:21:07
Subject: Re: One more time on ONE-TO-MANY
Previous:From: ramaDate: 2004-05-27 13:28:08
Subject: statement level triggers in PostgreSQL , anybody??

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group