On 2020-08-05 18:48, Ivan Přenosil wrote:
In FB2.5 I sometimes construct exception messages with newline like this
  EXCEPTION E_ERROR 'msg-á' || x'0A0D' || 'msg-é';

In FB3 and FB4 it can cause error
  Statement failed, SQLSTATE = 22000
  Malformed string
  -At block line: 4, col: 3

Problem is caused by the fact that x'0A0D' is OCTETS.
Normally character set of concatenation is derived from first not-NONE character set,
except when any part is OCTETS (then the result is OCTETS too).
Althought workaround is easy, just change character set of the literal like this
  EXCEPTION E_ERROR 'msg-á' || _WIN1250 x'0A0D' || 'msg-é';
it can cause problems with upgrading Firebird server (now I need to fix lots of procedures/triggers/execute blocks).
Should I put it into tracker, or is it just as designed/expected?

For me that looks like a bug - but see later...


Example:

CREATE DATABASE 'localhost/3050:Z:\testDB.fdb' USER 'SYSDBA' PASSWORD 'masterkey' DEFAULT CHARACTER SET WIN1250;

CREATE EXCEPTION  E_ERROR 'err';

set term ^;
EXECUTE BLOCK AS
BEGIN
  EXCEPTION E_ERROR 'msg-á' || x'0A0D' || 'msg-é';
END^
set term ;^


Not reproduced:

SQL> CREATE DATABASE '~/testDB.fdb' USER 'SYSDBA' PASSWORD 'masterkey' DEFAULT CHARACTER SET WIN1250;
SQL> CREATE EXCEPTION  E_ERROR 'err';
SQL>
SQL> set term ^;
SQL> EXECUTE BLOCK AS
CON> BEGIN
CON>   EXCEPTION E_ERROR 'msg-á' || x'0A0D' || 'msg-é';
CON> END^
Statement failed, SQLSTATE = HY000
exception 1
-E_ERROR
-msg-á
msg-é
-At block line: 3, col: 3
SQL> set term ;^
SQL> show version;
ISQL Version: LI-V4.0.0.2189-dev Firebird 4.0 Release Candidate 1
Server version:
Firebird/Linux/AMD/Intel/x64 (access method), version "LI-V4.0.0.2189-dev Firebird 4.0 Release Candidate 1"
on disk structure version 13.0
SQL>




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

Reply via email to