Re: how do i avoid multiple sessions from inserting the

From: Kolus Maximiliano <Kolus(dot)maximiliano(at)bcr(dot)com(dot)ar>
To: patrick(dot)fiche(at)aqsacom(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: how do i avoid multiple sessions from inserting the
Date: 2003-02-24 17:51:40
Message-ID: A56C8EE648A74A4F9653B071E9F71420B6BE84@bcrweb.bcr.com.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> 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(at)doe(dot)com')
WHERE NOT EXISTS
(SELECT id FROM users WHERE email='john(at)doe(dot)com');

ERROR: parser: parse error at or near "WHERE"

(Btw, i didnt know that INSERT would accept a WHERE clause)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dmitry Tkach 2003-02-24 17:59:54 Re: A few questions to real pgsql gurus
Previous Message Dmitry Tkach 2003-02-24 17:48:29 Re: A few questions to real pgsql gurus