Re: Replace into...

From: brew(at)theMode(dot)com
To: "'PGSQL-NOVICE(at)postgresql(dot)org'" <PGSQL-NOVICE(at)postgresql(dot)org>
Cc: jcboget(at)yahoo(dot)com
Subject: Re: Replace into...
Date: 2003-07-06 00:22:11
Message-ID: Pine.BSF.4.44.0307052018340.14292-100000@themode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


Hi Chris.......

> The problem, though, is that I need this type of functionality... To
> INSERT or UPDATE depending on whether or not the record is already
> there. I've spent the last several hours trying to figure out how I can
> set up a trigger to do this.

Don't know about a trigger, but the way I do this is do a SELECT, if no
rows are returned I do an INSERT, if rows are returned I do an UPDATE.

Somebody else probably has a more clever way to do it though......

brew

==========================================================================
Strange Brew (brew(at)theMode(dot)com)
Check out my Musician's Online Database Exchange (The MODE Pages)
http://www.TheMode.com
==========================================================================

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Martin Foster 2003-07-06 04:54:57 Extreme high load averages
Previous Message Boget, Chris 2003-07-05 15:25:03 Replace into...