firebird
firebird copied to clipboard
Weird output for "INSERT INTO <VIEW with CHECK> (<FLD>) VALUES( <correct_value>) RETURNING <FLD>" // 3.x ... 6.x
Consider script:
set bail on;
set count on;
set heading off;
shell if exist r:\temp\tmp4test.fdb del r:\temp\tmp4test.fdb;
create database 'localhost:r:\temp\tmp4test.fdb' user 'sysdba' password 'masterkey';
recreate table t1 (id int generated by default as identity, n1 int, n2 int);
recreate view v1 as select t1.n1 from t1 t1 where t1.n1 < coalesce(t1.n2,100) with check option;
recreate view v2 as select t1.n1 from t1 t1;
insert into v1(n1) values(11) returning n1;
insert into v2(n1) values(12) returning n1;
select * from t1;
quit;
Current snapshots show following output:
- on 3.x and 4.x:
insert into v1(n1) values(11) returning n1;
<null> -------------- [ 1 ] WHY ?
insert into v2(n1) values(12) returning n1;
12
select * from t1;
1 11 <null>
2 12 <null>
- on 5.x and 6.x:
insert into v1(n1) values(11) returning n1;
0 -------------- [ 2 ] WHY ??
insert into v2(n1) values(12) returning n1;
12
select * from t1;
1 11 <null>
2 12 <null>