[
http://tracker.firebirdsql.org/browse/CORE-4786?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pavel Zotov reopened CORE-4786:
-------------------------------
Consider following script encoded in UTF8:
set names utf8;
create database 'localhost/3333:C:\MIX\firebird\QA\fbt-repo\tmp\c4786.fdb';
recreate table test_utf8(s varchar(169) character set utf8 constraint
test_cs_utf8_unq unique using index test_cs_utf8_unq);
commit;
insert into test_utf8 values( rpad('', 164, 'A') || '12345' );
insert into test_utf8 values( rpad('', 164, 'A') || '12345' );
insert into test_utf8 values( rpad('', 164, 'Á') || '12345' ); -- multi-byte
character "a-acute", U+00C1
insert into test_utf8 values( rpad('', 164, 'Á') || '12345' );
It will produce STDERR:
===
Statement failed, SQLSTATE = 23000
violation of PRIMARY or UNIQUE KEY constraint "TEST_CS_UTF8_UNQ" on table
"TEST_UTF8"
-Problematic key value is ("S" =
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA12345')
Statement failed, SQLSTATE = 23000
violation of PRIMARY or UNIQUE KEY constraint "TEST_CS_UTF8_UNQ" on table
"TEST_UTF8"
-Problematic key value is ("S" =
'ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁî..)
===
Note: after last 'Á' in the second message we see NOT 'dot' character but "î".
This is because output ignores multi-byte nature of key that violates PK/UK.
If we open this STDERR in some editor that doesn`t support UTF8, we'll see
there:
"S" = 'Г_Г_Г_Г_ <skipped> Г_Г...)
-- and no "_" after final "Г" that should be there.
> Problematic key value (when attempt to insert duplicate in PK/UK) is not
> shown where length of key >= 127 characters
> --------------------------------------------------------------------------------------------------------------------
>
> Key: CORE-4786
> URL: http://tracker.firebirdsql.org/browse/CORE-4786
> Project: Firebird Core
> Issue Type: Bug
> Components: Engine
> Affects Versions: 3.0 Beta 1, 2.1.7, 2.5.4
> Reporter: Pavel Zotov
> Assignee: Dmitry Yemanov
> Fix For: 3.0 Beta 2, 2.5.5
>
>
> SQL> insert into test(s) values( rpad('', 126, 'qwertyuioplkjhgfdsazxcvbnm')
> );
> SQL> insert into test(s) values( rpad('', 126, 'qwertyuioplkjhgfdsazxcvbnm')
> );
> Statement failed, SQLSTATE = 23000
> violation of PRIMARY or UNIQUE KEY constraint "TEST_PK" on table "TEST"
> -Problematic key value is ("S" =
> 'qwertyuioplkjhgfdsazxcvbnmqwertyuioplkjhgfdsazxcvbnmqwertyuioplkjhgfdsazxcvbnmqwertyuioplkjhgfdsazxcv
> bnmqwertyuioplkjhgfdsazxc')
> SQL>
> SQL> recreate table test(s varchar(127), constraint test_pk primary key(s) );
> commit;
> SQL> insert into test(s) values( rpad('', 127, 'qwertyuioplkjhgfdsazxcvbnm')
> );
> SQL> insert into test(s) values( rpad('', 127, 'qwertyuioplkjhgfdsazxcvbnm')
> );
> Statement failed, SQLSTATE = 23000
> violation of PRIMARY or UNIQUE KEY constraint "TEST_PK" on table "TEST"
> -arithmetic exception, numeric overflow, or string truncation
> -string right truncation
> -expected length 126, actual 127
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel