You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Message 'malformed string' appear instead of 'expected length 8191, actual NNNN' when trying to generate UTF8 multi-byte chars with char_length >= 10922 [CORE4894]
#5187
Script for running on Windows (replace port and path + database file with your env.):
set names utf8;
set list on;
shell del C:\MIX\firebird\QA\fbt-repo\tmp\c4881.fdb 2>nul;
create database 'localhost/3333:C:\MIX\firebird\QA\fbt-repo\tmp\c4881.fdb' default character set utf8;
commit;
set list on;
out nul;
select rpad('', 10921,'∏Ω∑') as multi_byte_10921 from rdb$database;
select rpad('', 10922,'∏Ω∑') as multi_byte_10922 from rdb$database;
out;
quit;
Similar script for running on Linux:
set names utf8;
set list on;
shell rm -f /var/db/fb30/c4881.fdb 2>nul;
create database 'localhost/3333:/var/db/fb30/c4881.fdb' default character set utf8;
commit;
set list on;
out /dev/null;
select rpad('', 10921,'∑∏Ω') as multi_byte_10921 from rdb$database;
select rpad('', 10922,'∑∏Ω') as multi_byte_10922 from rdb$database;
out;
quit;
Result in any case will be:
Statement failed, SQLSTATE = 22001
arithmetic exception, numeric overflow, or string truncation
-string right truncation
-expected length 8191, actual 10921
IMHO, second expression (which tries to do RPAD up to 10922 should raise the same exception as first one, no matter of its argument.
PS.
All three characters in the padded string '∑', '∏' and 'Ω' -- requires three byte for encoding. Symbol '∏' should not be confused with cyrillic upper 'Pe', it is mathematical sign of number producing.
The text was updated successfully, but these errors were encountered:
description: Script for running on Windows (replace port and path + database file with your env.):
set names utf8;
set list on;
shell del C:\MIX\firebird\QA\fbt-repo\tmp\c4881.fdb 2>nul;
create database 'localhost/3333:C:\MIX\firebird\QA\fbt-repo\tmp\c4881.fdb' default character set utf8;
commit;
set list on;
out nul;
select rpad('', 10921,'∏Ω∑') as multi_byte_10922 from rdb$database;
select rpad('', 10922,'∏Ω∑') as multi_byte_10922 from rdb$database;
out;
quit;
Similar script for running on Linux:
set names utf8;
set list on;
shell rm -f /var/db/fb30/c4881.fdb 2>nul;
create database 'localhost/3333:/var/db/fb30/c4881.fdb' default character set utf8;
commit;
set list on;
out /dev/null;
select rpad('', 10921,'∑∏Ω') as multi_byte_10921 from rdb$database;
select rpad('', 10922,'∑∏Ω') as multi_byte_10922 from rdb$database;
out;
quit;
Result in any case will be:
Statement failed, SQLSTATE = 22001
arithmetic exception, numeric overflow, or string truncation
-string right truncation
-expected length 8191, actual 10921
IMHO, second expression (which tries to do RPAD up to 10922 should raise the same exception as first one, no matter of its argument.
PS.
All three characters in the padded string '∑', '∏' and 'Ω' -- requires three byte for encoding. Symbol '∏' should not be confused with cyrillic upper 'Pe', it is mathematical sign of number producing.
=>
Script for running on Windows (replace port and path + database file with your env.):
set names utf8;
set list on;
shell del C:\MIX\firebird\QA\fbt-repo\tmp\c4881.fdb 2>nul;
create database 'localhost/3333:C:\MIX\firebird\QA\fbt-repo\tmp\c4881.fdb' default character set utf8;
commit;
set list on;
out nul;
select rpad('', 10921,'∏Ω∑') as multi_byte_10921 from rdb$database;
select rpad('', 10922,'∏Ω∑') as multi_byte_10922 from rdb$database;
out;
quit;
Similar script for running on Linux:
set names utf8;
set list on;
shell rm -f /var/db/fb30/c4881.fdb 2>nul;
create database 'localhost/3333:/var/db/fb30/c4881.fdb' default character set utf8;
commit;
set list on;
out /dev/null;
select rpad('', 10921,'∑∏Ω') as multi_byte_10921 from rdb$database;
select rpad('', 10922,'∑∏Ω') as multi_byte_10922 from rdb$database;
out;
quit;
Result in any case will be:
Statement failed, SQLSTATE = 22001
arithmetic exception, numeric overflow, or string truncation
-string right truncation
-expected length 8191, actual 10921
IMHO, second expression (which tries to do RPAD up to 10922 should raise the same exception as first one, no matter of its argument.
PS.
All three characters in the padded string '∑', '∏' and 'Ω' -- requires three byte for encoding. Symbol '∏' should not be confused with cyrillic upper 'Pe', it is mathematical sign of number producing.
Submitted by: @pavel-zotov
Script for running on Windows (replace port and path + database file with your env.):
set names utf8;
set list on;
shell del C:\MIX\firebird\QA\fbt-repo\tmp\c4881.fdb 2>nul;
create database 'localhost/3333:C:\MIX\firebird\QA\fbt-repo\tmp\c4881.fdb' default character set utf8;
commit;
set list on;
out nul;
select rpad('', 10921,'∏Ω∑') as multi_byte_10921 from rdb$database;
select rpad('', 10922,'∏Ω∑') as multi_byte_10922 from rdb$database;
out;
quit;
Similar script for running on Linux:
set names utf8;
set list on;
shell rm -f /var/db/fb30/c4881.fdb 2>nul;
create database 'localhost/3333:/var/db/fb30/c4881.fdb' default character set utf8;
commit;
set list on;
out /dev/null;
select rpad('', 10921,'∑∏Ω') as multi_byte_10921 from rdb$database;
select rpad('', 10922,'∑∏Ω') as multi_byte_10922 from rdb$database;
out;
quit;
Result in any case will be:
Statement failed, SQLSTATE = 22001
arithmetic exception, numeric overflow, or string truncation
-string right truncation
-expected length 8191, actual 10921
Statement failed, SQLSTATE = 22000
Malformed string
IMHO, second expression (which tries to do RPAD up to 10922 should raise the same exception as first one, no matter of its argument.
PS.
All three characters in the padded string '∑', '∏' and 'Ω' -- requires three byte for encoding. Symbol '∏' should not be confused with cyrillic upper 'Pe', it is mathematical sign of number producing.
The text was updated successfully, but these errors were encountered: