Re: how do i avoid multiple sessions from inserting the

Поиск
Список
Период
Сортировка
От Kolus Maximiliano
Тема Re: how do i avoid multiple sessions from inserting the
Дата
Msg-id A56C8EE648A74A4F9653B071E9F71420B6BE84@bcrweb.bcr.com.ar
обсуждение исходный текст
Ответы Re: how do i avoid multiple sessions from inserting the  (Dennis Gearon <gearond@cvc.net>)
Re: how do i avoid multiple sessions from inserting the  (Dmitry Tkach <dmitry@openratings.com>)
Re: how do i avoid multiple sessions from inserting the  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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@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)
 

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: A few questions to real pgsql gurus
Следующее
От: Dmitry Tkach
Дата:
Сообщение: 7.4?