Subject Cannot transliterate character between character sets
Author Stefan Sinne
We recently switched one of our databases from FB2.0 to FB2.1.1 taking
into account
the notice in /misc/upgrade/metadata.

Still we get the above error when executing the following select:
select * from rdb$procedures where rdb$procedure_source like '%TEST%'

All of our databases and connections use NONE as character set.

This is how you can reproduce the error:

Execute with isql in Firebird 2.0:
_______________ script start _______________________________
SET SQL DIALECT 3;
SET NAMES NONE;

CREATE DATABASE 'LOCALHOST:d:\database\prueba.fdb'
USER 'SYSDBA' PASSWORD 'masterkey'
PAGE_SIZE 4096
DEFAULT CHARACTER SET NONE;

SET TERM ^ ;
CREATE PROCEDURE NEW_PROCEDURE
AS
begin
/* Some special (spanish) chars: ñѺªáÁéÉíÍóÓúÚ */
exit;
end
^
SET TERM ; ^
_______________ script end _______________________________

Then backup with FB 2.0 and restore with FB 2.1:

"c:\Archivos de programa\Firebird\Firebird_2_0\bin\gbak.exe" -b -v -g
-user sysdba -pass masterkey localhost/gds_db:d:\database\prueba.fdb
prueba.fbk
"c:\Archivos de programa\Firebird\Firebird_2_1\bin\gbak.exe" -c -v -p
4096 -user sysdba -pass masterkey prueba.fbk
localhost/gds_fb21:d:\Database_fb21\prueba.fdb

Finally execute the following script with isql of Firebird 2.1:
_______________ script start _______________________________
SET ECHO;
SET SQL DIALECT 3;
SET NAMES NONE;
CONNECT 'localhost/gds_fb21:d:\database_fb21\prueba.fdb' USER 'SYSDBA'
PASSWORD 'masterkey';
input 'c:\Archivos de
programa\Firebird\Firebird_2_1\misc\upgrade\metadata\metadata_charset_create.sql';
COMMIT;

CONNECT 'localhost/gds_fb21:d:\database_fb21\prueba.fdb' USER 'SYSDBA'
PASSWORD 'masterkey';
select * from rdb$fix_metadata('NONE');
COMMIT;

CONNECT 'localhost/gds_fb21:d:\database_fb21\prueba.fdb' USER 'SYSDBA'
PASSWORD 'masterkey';
select * from rdb$procedures where rdb$procedure_source like '%TEST%';
COMMIT;
_______________ script end _______________________________

The last select will return the error

can't format message 17:0 -- message system code -4
arithmetic exception, numeric overflow, or string truncation
-Cannot transliterate character between character sets

I am sure there must be a simple solution to this problem, though I'm
not able to find it.
Can anyone point me to the error I am commiting?

Thanks,

Stefan