Subject INSERT ... RETURNING and updatable view
Author Emil Totev
Hi

Server Version: WI-V2.5.2.26539 Firebird 2.5 on Win7.

Here is my simplified test case:

SQL> Create Database 'test.fdb' user 'sysdba' password 'masterkey';
SQL>
SQL> create table T (ID integer);
SQL>
SQL> create view V as select ID from T;
SQL>
SQL> create sequence SEQ;
SQL>
SQL> set term ^;
SQL>
SQL> create trigger T_BI for T before insert as
CON> begin
CON> new.ID = next value for SEQ;
CON> end^
SQL>
SQL> create trigger V_BI for V before insert as
CON> begin
CON> insert into T values (new.ID);
CON> end^
SQL>
SQL> set term ; ^
SQL>
SQL> insert into T values (9) returning ID;

ID
============
1

SQL>
SQL> insert into V values (101) returning ID;

ID
============
101

SQL> select * from V;

ID
============
1
2

SQL>

Would you say it is a bug, or just counter-intuitive?

Thanks
Emil


[Non-text portions of this message have been removed]