ora2pg icon indicating copy to clipboard operation
ora2pg copied to clipboard

NULL test for global variable fails if testing for NULL and empty string

Open duursma opened this issue 2 years ago • 1 comments

The line:

IF (g_bgm_imp_id IS NOT NULL) THEN

gets translated to:

IF (current_setting('bgm_file_import.g_bgm_imp_id')::(numeric(38) IS NOT NULL AND (numeric(38))::text <> '')) THEN

where g_bgm_imp_id is a global variable. With the NULL_EQUAL_EMPTY setting.

duursma avatar Jun 09 '22 14:06 duursma

Right, the case where global variable was tested against NULL was not handled by Ora2Pg, commit 901d29b might fix this issue.

Actually for this test NULL_EQUAL_EMPTY doesn't apply, the translation of your example will be the following:

IF ( current_setting('bgm_file_import.g_bgm_imp_id') != '' ) THEN

darold avatar Jun 13 '22 13:06 darold