Re: Inserting Data - Mailing list pgsql-general

From Michael Fuhr
Subject Re: Inserting Data
Date
Msg-id 20060824060840.GA91205@winnie.fuhr.org
Whole thread Raw
In response to Re: Inserting Data  (Bob Pawley <rjpawley@shaw.ca>)
List pgsql-general
On Wed, Aug 23, 2006 at 05:34:27PM -0700, Bob Pawley wrote:
> Could you explain why Postgresql simply doesn't accept the simple 'where'
> statement that was in my earlier e-mail.

Because INSERT doesn't take a WHERE clause.  If you want to do the
insert conditionally then use an IF statement as Tom suggested or
use INSERT ... SELECT with a WHERE clause that would restrict the
SELECT result to an empty set if the insert shouldn't happen.

--
Michael Fuhr

pgsql-general by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: [JDBC] org.postgresql.util.PSQLException: An I/O error occured
Next
From: Michael Fuhr
Date:
Subject: Re: Inserting Data