Re: how do i avoid multiple sessions from inserting the

From: Dennis Gearon <gearond(at)cvc(dot)net>
To: patrick(dot)fiche(at)aqsacom(dot)com, pgsql-general(at)postgresql(dot)org, Kolus Maximiliano <Kolus(dot)maximiliano(at)bcr(dot)com(dot)ar>
Subject: Re: how do i avoid multiple sessions from inserting the
Date: 2003-02-24 18:50:29
Message-ID: FAVR2ZF0JFFC3Y934YIRPVQBAOMQKPL.3e5a6975@cal-lab
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You might have duplicate john doeos with diffent ID's

2/24/2003 9:51:40 AM, Kolus Maximiliano <Kolus(dot)maximiliano(at)bcr(dot)com(dot)ar> wrote:

>
>
> 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: [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(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)
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dennis Gearon 2003-02-24 18:51:08 Re: 7.4?
Previous Message Larry Rosenman 2003-02-24 18:10:52 Re: A few questions to real pgsql gurus