Re: Replaceing records

From: Jonathan Bartlett <johnnyb(at)eskimo(dot)com>
To: Richard Ellis <rellis9(at)yahoo(dot)com>
Cc: PgSQL General ML <pgsql-general(at)postgresql(dot)org>
Subject: Re: Replaceing records
Date: 2003-09-04 19:26:28
Message-ID: Pine.GSU.4.44.0309041225510.4262-100000@eskimo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

However, that doesn't cover the case where you want to update the record
if it already exists.

Jon

> insert into test (a, b, c, d)
> (select 1, 2, 3, 4 where not exists
> (select 1 from test where a=1 and b=2 and c=3 and d=4)
> );
>
> If your table contains a=1, b=2, c=3, and d=4, nothing will happen, and
> there will be no failed transaction. If your table does not contain a=1,
> b=2, c=3, and d=4, you'll get an insert of a row containing 1, 2, 3, 4.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2003-09-04 19:29:17 Re: Replaceing records
Previous Message Jan Wieck 2003-09-04 19:24:21 Re: how to call a TCL function from within a plpgsql trigger?