The new BLOB_APPEND function has a NULL behaviour that is not consistent with the normal NULL behaviour. Using NULL in BLOB_APPEND behaves as an empty string, while the normal behaviour for functions and operations involving NULL is to result in NULL.

For example, normal concatenation:

select cast(null as blob sub_type text) || cast('a' as blob sub_type text) || cast(null as blob sub_type text) || cast('b' as blob sub_type text) from rdb$database;

results in NULL, while BLOB_APPEND:

select blob_append(null, 'a', null, 'b') from rdb$database;

results in 'ab'.

If the "normal" NULL-behaviour had been used, it would be possible to easily rewrite normal concatenation involving blobs to BLOB_APPEND, but now that requires careful consideration. In addition, this closes an avenue for the engine to - at some point in the future, as an engine optimization - rewrite concatenation to BLOB_APPEND internally.

Why was this NULL behaviour chosen?

Mark
--
Mark Rotteveel


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to