From: | Bruno Wolff III <bruno(at)[66(dot)92(dot)219(dot)49]> |
---|---|
To: | Terrence Brannon <metaperl(at)mac(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: how does one replace a row in Postgresql? (ala MySQL REPLACE) |
Date: | 2001-12-12 12:45:56 |
Message-ID: | 20011212064556.A32473@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice pgsql-sql |
On Tue, Dec 11, 2001 at 02:09:19PM -0800,
Terrence Brannon <metaperl(at)mac(dot)com> wrote:
> A common task is to check to see if a row with a certain primary
> key exists before inserting it. If the row exists, then you
> simply update/overwrite its contents with the new row data.
> Otherwise you insert it.
>
> MySQL has a REPLACE command which does this.
>
> I didn't see one in the Postgresql manual. How do you do this in
> Postgresql?
Another option that doesn't require testing of the response from one
sql statement before executing another is to delete rows with the
matching primary key. Then do an insert.
From | Date | Subject | |
---|---|---|---|
Next Message | S P Arif Sahari Wibowo | 2001-12-12 16:24:24 | Varying bit field: to set and query a particular bit |
Previous Message | Philip Hallstrom | 2001-12-12 00:39:06 | Re: how does one replace a row in Postgresql? (ala MySQL REPLACE) |
From | Date | Subject | |
---|---|---|---|
Next Message | Jason Earl | 2001-12-12 17:40:39 | Re: Variable Length Binary String (not large) |
Previous Message | Haller Christoph | 2001-12-12 11:53:15 | Re: Variable Length Binary String (not large) |