[firebird-support] Re: INSERT ... RETURNING and updatable view
--- In firebird-support@yahoogroups.com, Paul Vinkenoog wrote: > > It is often more useful to define the BI trigger as: > > create trigger T_BI for T before insert as > begin > if (new.ID is null) then new.ID = next value for SEQ; > end^ > > (but if you had done that, you wouldn't have detected the inconsistency below > ;-)) Well, I've seen that but I don't like the idea. An auto-generated ID should be auto-generated in all cases. Imagine for example someone inserting a random higher value that will one day come into conflict with the sequence-generated... > > insert into T values (new.ID) returning T.id into :new.id; > > That would solve the whole problem (he said without having tested it). Yes, that works, but I consider it a workaround :) The same thing happens for calculated and DEFAULT fields as well. Thanks Emil
[firebird-support] Re: INSERT ... RETURNING and updatable view
02.02.2013 16:51, ettotev wrote: > > Yes, that works, but I consider it a workaround :) > The same thing happens for calculated and DEFAULT fields as well. FWIW, you have to live with that. It's unlikely to change in the foreseeable future. Dmitry
[firebird-support] Re: INSERT ... RETURNING and updatable view
--- In firebird-support@yahoogroups.com, Dmitry Yemanov wrote: > > 02.02.2013 16:51, ettotev wrote: > > > > Yes, that works, but I consider it a workaround :) > > The same thing happens for calculated and DEFAULT fields as well. > > FWIW, you have to live with that. It's unlikely to change in the > foreseeable future. > > > Dmitry > Sure I can live with it. It might help others if a note is inserted somewhere in the documentation, that for the RETURNING clause to work correctly for updatable views with generated, default or computed fields, the respective NEW variables must be explicitly assigned. Still, does this qualify as a bug? Shall I put an entry in the tracker? Thanks Emil
Re: [firebird-support] Re: INSERT ... RETURNING and updatable view
Emil wrote: > It might help others if a note is inserted somewhere in the documentation, > that for the RETURNING clause to work correctly for updatable views with > generated, default or computed fields, the respective NEW variables must be > explicitly assigned. Good point. I'll put that in the tracker for the doc subproject. Paul Vinkenoog