Re: INSERT ON DUPLICATE KEY UPDATE - Mailing list pgsql-general

From Duane Lee - EGOVX
Subject Re: INSERT ON DUPLICATE KEY UPDATE
Date
Msg-id 64EDC403A1417B4299488BAE87CA7CBF01CD0E95@maricopa_xcng0
Whole thread Raw
In response to INSERT ON DUPLICATE KEY UPDATE  (Eduardo Pérez Ureta <eperez@it.uc3m.es>)
Responses Re: INSERT ON DUPLICATE KEY UPDATE  (Robert Treat <xzilla@users.sourceforge.net>)
List pgsql-general

I agree.  You could always do a SELECT and if the record was found then UPDATE otherwise INSERT.  A little more effort than MYSQL but again I don't believe the way MYSQL is allowing you to do it is standard.

Duane

-----Original Message-----
From: Richard Huxton [mailto:dev@archonet.com]
Sent: Friday, June 18, 2004 11:02 AM
To: Eduardo Pérez Ureta
Cc: Duane Lee - EGOVX; pgsql-general@postgresql.org
Subject: Re: [GENERAL] INSERT ON DUPLICATE KEY UPDATE

Eduardo Pérez Ureta wrote:
> On 2004-06-18 17:19:40 UTC, Duane Lee - EGOVX wrote:
>
>>I would suspect you would need to write a trigger to do this.
>
>
> It seems the mysql way of doing this is easier and safer.

And non-standard AFAIK.

> Why is that not implemented in postgresql?
> Is it better done with a trigger or with any other way?

Out of curiosity, why don't you know whether you're inserting or
updating? It always worries me when I don't know what my application is
doing.

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: Thomas Hallgren
Date:
Subject: Re: 7.4 windows version?
Next
From: ecomeau@signiant.com (Eric)
Date:
Subject: Re: PgSQL shut down