Hi *,

both 2.5.7 and 3.0.3 have same behavior, so it's probably expected. But
still, looks wrong to me (in such case educate me).

SQL> create table foobar (id int primary key, foo int, bar generated
always as (foo+1));
SQL> insert into foobar values (1, 1);
SQL> update foobar set foo = 2 where id = 1 returning bar;

                  BAR
=====================
                    3

SQL> update foobar set foo = 2 where id = -1 returning bar;

                  BAR
=====================
               <null>

SQL>

The second update did not update any records, yet it still returns one
row in result with NULL value. Shouldn't it return empty result set?
With this I don't know whether the RETURNING returns NULL as a new value
or nothing was updated. I would have to go to PSQL and use ROW_COUNT or
something like that.

-- 
Mgr. Jiří Činčura
https://www.tabsoverspaces.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to