Subject Re: [Firebird-Architect] Replace the statement REPLACE
Author Nando Dessena
Adriano, Arno,

A> Arno Brinkman wrote:
>> When showing the "INSERT OR UPDATE" it was clear for both that
>> it will perform first INSERT else UPDATE, because
>> internally it first performs UPDATE and then INSERT when needed
>> we suggest to use "UPDATE OR INSERT".
>>
A> Yes, if it is to be changed, the better name is "UPDATE OR INSERT".

Not necessarily. It could be interpreted as "INSERT OR, if the record
already exists, UPDATE it". It is actually what I think when reading
"INSERT OR UPDATE". I don't think at the temporal sequence of events.

What it does internally shouldn't necessarily be reflected in the
verb's name, also because Fb might want to be able to change the
internals in the future (say, performing an insert and trap the
exception, or performing an existence check first).

The rationale behind INSERT OR UPDATE (in this order) is that the main
operation, or the most common case, comes first. Then the exceptions.
It is clear that the intent of the operation is to make sure a
particular record exists (*) and contains current values, that's why
INSERT looks more preminent than UPDATE. At least IMHO.

(*) which suggests that ENSURE is also a good candidate.

Ciao
--
Nando Dessena