You might have duplicate john doeos with diffent ID's
2/24/2003 9:51:40 AM, Kolus Maximiliano <Kolus.maximiliano@bcr.com.ar> wrote:
>
>
> From: Kolus Maximiliano <Kolus.maximiliano@bcr.com.ar>
>
> To: patrick.fiche@aqsacom.com, pgsql-general@postgresql.org
> Subject:Re: [GENERAL] how do i avoid multiple sessions from inserting the
> Date: Mon, 24 Feb 2003 14:51:40 -0300
>
>
>
>
> > Why not something like that ?
>
> [...]
> > 2) IF NULL -> INSERT INTO users values (....'blah' ) WHERE NOT EXISTS
> ....
> > -> SELECT id FROM users WHERE email = 'blah'
>
>
> I tried, but it's giving me an error, as if INSERT wouldn't like the WHERE:
>
>
> INSERT INTO users (email) VALUES ('john@doe.com')
> WHERE NOT EXISTS
> (SELECT id FROM users WHERE email='john@doe.com');
>
>
> ERROR: parser: parse error at or near "WHERE"
>
>
> (Btw, i didnt know that INSERT would accept a WHERE clause)
>