Subject Re: [Firebird-Architect] REPLACE, again
Author Adriano dos Santos Fernandes
Alex Peshkov wrote:
> Yes, we need to be as standard compliant as possible.
> But nothing prevents us from having non-standard extensions, if we find
> that they make life better. I suppose that REPLACE via MERGE is such
> extension, is not it?

> Ideally we should support MERGE in all it's complexity, and as soon as
> we are able to compile REPLACE using that same execution tree, it will
> become fine extension of SQL language, making life easier in trivial
> cases, when full MERGE capabilities are not required. But (returning to
> our initial problem) RETURNING clause is not present now in MERGE
> specification - at least I don't see it in both Oracle docs or available
> to me form of sql2003. But nothing prevents us from having it! In the
> future.
> If right now any developer wants to implement REPLACE, not MERGE, I see
> no problems. But please make it possible to use that same parts of code
> - BLR, execution tree node(s), etc. - later in MERGE.
That is the idea.
Implement both in DSQL.

REPLACE using combination of update / if row_count / insert.
MERGE using joined cursor / update / insert.

BTW, I don't know if we can support MERGE using the same table twice
It's a kind of INSERT INTO table SELECT FROM table.