Re: Replace into... - Mailing list pgsql-novice

From brew@theMode.com
Subject Re: Replace into...
Date
Msg-id Pine.BSF.4.44.0307052018340.14292-100000@themode.com
Whole thread Raw
In response to Replace into...  ("Boget, Chris" <chris@wild.net>)
Responses Re: Replace into...  (Nabil Sayegh <postgresql@e-trolley.de>)
List 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@theMode.com)
     Check out my Musician's Online Database Exchange (The MODE Pages)
                        http://www.TheMode.com
 ==========================================================================



pgsql-novice by date:

Previous
From: "Boget, Chris"
Date:
Subject: Replace into...
Next
From: Martin Foster
Date:
Subject: Extreme high load averages