Re: if exists...does it exists for insert statments? - Mailing list pgsql-general

From Richard Broersma Jr
Subject Re: if exists...does it exists for insert statments?
Date
Msg-id 767744.63134.qm@web31811.mail.mud.yahoo.com
Whole thread Raw
In response to Re: if exists...does it exists for insert statments?  ("Pau Marc Munoz Torres" <paumarc@gmail.com>)
List pgsql-general
--- On Tue, 12/11/07, Pau Marc Munoz Torres <paumarc@gmail.com> wrote:

> Thanks, i'll test it tomorrow

OOPS, I just noticed a mistake.

INSERT INTO SP
     SELECT a, b
       FROM ( VALUES ( 'cesp', 'sp' )) AS tmp( a, b )
  LEFT JOIN Sp
         ON (Sp.col1,Sp.col2)=(tmp.a,tmp.b)
      WHERE (Sp.col1,Sp.col2) IS NULL;

I forgot the parentheses that the FROM clause requires when using the VALUES predicate.  Also remember that this only
worksin PostgreSQL versions >= 8.2. 

Regards,
Richard Broersma Jr.

pgsql-general by date:

Previous
From: "Pau Marc Munoz Torres"
Date:
Subject: Re: if exists...does it exists for insert statments?
Next
From: Raymond O'Donnell
Date:
Subject: Re: Hijack!