Re: most idiomatic way to "update or insert"? - Mailing list pgsql-general

From Pierre-Frédéric Caillaud
Subject Re: most idiomatic way to "update or insert"?
Date
Msg-id opsb8ykvcgcq72hf@musicbox
Whole thread Raw
In response to Re: most idiomatic way to "update or insert"?  (Lincoln Yeoh <lyeoh@pop.jaring.my>)
List pgsql-general
I use stored procedures :

create function insertorupdate(....)
    UPDATE mytable WHERE ... SET ...
    IF NOT FOUND THEN
        INSERT INTO mytable ...
    END IF;


    You lose flecibility in your request though.

    I wish Postgresql had an INSERT OR UPDATE like MySQL does. So far it's
the only thing that I regret from MySQL.

pgsql-general by date:

Previous
From: "Scott Marlowe"
Date:
Subject: Re: Test case for bug fix in 7.4.3
Next
From: Prabu Subroto
Date:
Subject: Re: Sequence Question