how does one replace a row in Postgresql? (ala MySQL REPLACE)

From: Terrence Brannon <metaperl(at)mac(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: how does one replace a row in Postgresql? (ala MySQL REPLACE)
Date: 2001-12-11 22:09:19
Message-ID: B9A8DB2D-EE83-11D5-9845-003065C2A10C@mac.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice pgsql-sql

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?

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Philip Hallstrom 2001-12-12 00:39:06 Re: how does one replace a row in Postgresql? (ala MySQL REPLACE)
Previous Message Travis Hoyt 2001-12-11 21:20:28 Re: counting columns

Browse pgsql-sql by date

  From Date Subject
Next Message Philip Hallstrom 2001-12-12 00:39:06 Re: how does one replace a row in Postgresql? (ala MySQL REPLACE)
Previous Message Shaun Thomas 2001-12-11 21:47:25 Re: How would i do this?