 ALTER MODULE LOGGER
   DROP FUNCTION GET_LOGGER_DATA2 @
 
-ALTER MODULE LOGGER
-  DROP FUNCTION GET_LOGGER_NAME2 @
-
 ALTER MODULE LOGGER DROP TYPE LOGGERS_ROW @
 
 ALTER MODULE LOGGER ADD

  WHERE FUNCNAME LIKE 'GET_LOGGER_DATA'
  AND FUNCSCHEMA LIKE 'LOGGER_1RC';
EXECUTE IMMEDIATE QUERY;

SELECT
  REPLACE
   (REPLACE
    (REPLACE
     (REPLACE
      (REPLACE
       (BODY,
       'ALTER MODULE LOGGER ADD',
       'ALTER MODULE LOGGER PUBLISH'),
      'FUNCTION GET_LOGGER_NAME',
      'FUNCTION GET_LOGGER_NAME2'),
     'SPECIFIC F_GET_LOGGER_NAME',
     'SPECIFIC F_GET_LOGGER_NAME2'),
    'F_GET_LOGGER_NAME: BEGIN',
    'F_GET_LOGGER_NAME2: BEGIN'),
   'END F_GET_LOGGER_NAME',
   'END F_GET_LOGGER_NAME2')
  INTO QUERY
  FROM SYSCAT.FUNCTIONS
  WHERE FUNCNAME LIKE 'GET_LOGGER_NAME'
  AND FUNCSCHEMA LIKE 'LOGGER_1RC';
EXECUTE IMMEDIATE QUERY;
END@

BEGIN

SET EXPECTED_NAME = '-internal-';
CALL LOGGER.ACTIVATE_CACHE();
CALL LOGGER.REFRESH_CACHE();
SET ACTUAL_NAME = LOGGER.GET_LOGGER_NAME(LOG_ID);
IF (EXPECTED_NAME <> ACTUAL_NAME) THEN
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different NAME');
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Expected ' || COALESCE(EXPECTED_NAME, 'NULL') || ' - actual ' || COALESCE(ACTUAL_NAME, 'NULL'));
