AW: Re: Re: REPLACE INTO table a la mySQL - Mailing list pgsql-hackers

From Zeugswetter Andreas SB
Subject AW: Re: Re: REPLACE INTO table a la mySQL
Date
Msg-id 11C1E6749A55D411A9670001FA687963368340@sdexcsrv1.f000.d0188.sd.spardat.at
Whole thread Raw
List pgsql-hackers
> I think that application people would probably prefer the delete trigger,
> insert trigger.  It makes more sense, because I would interpret replace
> as "get rid of the old if it exists" and "put in a new item". If people
> wanted
> to make sure code is run on delete, and they have to put it into a
> delete trigger and a replace trigger, it would be two places for them.
> 
> Frankly, I'm not sure why this is being seen as a weak approach.
> My indended semantic was atomic delete (ignoring error) and insert.

Adding another trigger event "replace" is imho not acceptable, since
people guarding their data integrity with standards defined triggers 
for insert update and delete would open the door to inconsistency 
because they have not defined a replace trigger.

Fire the delete then the insert trigger is imho not a straightforward answer,
since a second possible interpretation would be to fire eighter the insert trigger 
or the update trigger if a row already existed.

Andreas


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Problem with reading startup packet after fork
Next
From: Vivek Khera
Date:
Subject: Re: MySQL Question