Received: from teak.adhesivemedia.com (teak.adhesivemedia.com [207.202.159.79]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fBC0dKm11718 for ; Tue, 11 Dec 2001 19:39:21 -0500 (EST) (envelope-from philip@adhesivemedia.com) Received: from localhost (philip@localhost) by teak.adhesivemedia.com (8.11.6/8.11.6) with ESMTP id fBC0d6j77303; Tue, 11 Dec 2001 16:39:06 -0800 (PST) (envelope-from philip@adhesivemedia.com) Date: Tue, 11 Dec 2001 16:39:06 -0800 (PST) From: Philip Hallstrom To: Terrence Brannon cc: pgsql-sql@postgresql.org Subject: Re: how does one replace a row in Postgresql? (ala MySQL REPLACE) In-Reply-To: Message-ID: <20011211163822.O70071-100000@teak.adhesivemedia.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200112/118 X-Sequence-Number: 5941 Try to UPDATE the row. If that fails, then insert it. There's no REPLACE in postgresql (unless someone added it and forgot to tell me :) On Tue, 11 Dec 2001, Terrence Brannon 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? > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) >