Re: Inserting Data

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Bob Pawley <rjpawley(at)shaw(dot)ca>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Postgresql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Inserting Data
Date: 2006-08-24 06:08:40
Message-ID: 20060824060840.GA91205@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jasbinder Bali 2006-08-24 06:51:50 Re: [GENERAL] Shared Objects (Dynamic loading)
Previous Message surabhi.ahuja 2006-08-24 05:57:30 Re: [JDBC] org.postgresql.util.PSQLException: An I/O error occured while sending to the backend