Funny Parse Error on Insert - Mailing list pgsql-sql

From Orion
Subject Funny Parse Error on Insert
Date
Msg-id 9sp6lt$huk$1@news.tht.net
Whole thread Raw
List pgsql-sql
I am getting a parse error on insert and I cant tell why.  Anyone better at 
SQL what to lend me a hand?

I'm just doing a simple 'INSERT INTO table (x,y) SELECT ...'

Here's my statement and the error.

fdb=> INSERT INTO mfps_action_codes_394 (code,description) SELECT 
'$','Dun Notice Printed' WHERE NOT EXISTS (SELECT 1 FROM 
mfps_action_codes_394 WERE code = '$');
ERROR:  parser: parse error at or near "code"

Note if I remove the WHERE clause from the SELECT it works...

fdb=> INSERT INTO mfps_action_codes_394 (code,description) SELECT '$','Dun 
Notice Printed';
INSERT 9751582 1

Why would this happen?


pgsql-sql by date:

Previous
From: Orion
Date:
Subject: Re: Funny Parse Error on Insert
Next
From: Brian@McSweeney.iol.ie (Brian)
Date:
Subject: INSERT question