New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problematic key value (when attempt to insert duplicate in PK/UK) is not shown where length of key >= 127 characters [CORE4786] #5085
Comments
Modified by: @dyemanovassignee: Dmitry Yemanov [ dimitr ] |
Commented by: @dyemanov Fixed for v3, please test. Note that the textual key representation has a limit of 250 characters, so longer values will be truncated. |
Commented by: @pavel-zotov SQL> recreate table test(s varchar(300) unique using index test_unq); commit; Yes, it works better now, but I can see 249 (not 250) characters :-) // revision 61512. IMO, this limit should be documented ? |
Modified by: @dyemanovFix Version: 2.5.5 [ 10670 ] |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Resolved [ 5 ] Regressed in Version/s: 3.0 Beta 2, 2.5.5 [ 10586, 10670 ] QA Status: Done successfully Test Details: TODO: check what max. length will be for non-ascii characters (both narrow charsets like win1252 and UTF8). |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Resolved [ 5 ] QA Status: Done successfully => Done with caveats Test Details: TODO: check what max. length will be for non-ascii characters (both narrow charsets like win1252 and UTF8). => Currently (WI-T3.0.0.31844) output if key that violates PK/UK ignores fact that key can be in multi-byte encoding: |
Commented by: @pavel-zotov Consider following script encoded in UTF8: set names utf8; recreate table test_utf8(s varchar(169) character set utf8 constraint test_cs_utf8_unq unique using index test_cs_utf8_unq); insert into test_utf8 values( rpad('', 164, 'A') || '12345' ); It will produce STDERR:Statement failed, SQLSTATE = 23000 Statement failed, SQLSTATE = 23000
|
Modified by: @pavel-zotovstatus: Reopened [ 4 ] => Reopened [ 4 ] Test Details: Currently (WI-T3.0.0.31844) output if key that violates PK/UK ignores fact that key can be in multi-byte encoding: => Currently (WI-T3.0.0.31844) output if key that violates PK/UK ignores fact that key can be in multi-byte encoding: |
Commented by: @dyemanov Fix is committed, please test. Beware that the UTF8 value will be printed shorter, as the limit is actually 250 bytes, not characters. |
Commented by: @pavel-zotov Tested on multi-byte text keys with two- and three- bytes for character representation. Result: OK, no 'first-only-byte' effect as before. |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Resolved [ 5 ] QA Status: Done with caveats => Done successfully Test Details: Currently (WI-T3.0.0.31844) output if key that violates PK/UK ignores fact that key can be in multi-byte encoding: => WI-T3.0.0.31844: output if key that violates PK/UK ignores fact that key can be in multi-byte encoding. That leads to non-readable sequence of characters in STDERR. |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: @pavel-zotov
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
Commits: b4a6d47 3887b09 ea57454 5d5c473 FirebirdSQL/fbt-repository@ee8be5c FirebirdSQL/fbt-repository@103f0ee FirebirdSQL/fbt-repository@340b236 FirebirdSQL/fbt-repository@ee139ef
====== Test Details ======
WI-T3.0.0.31844: output if key that violates PK/UK ignores fact that key can be in multi-byte encoding. That leads to non-readable sequence of characters in STDERR.
LI-T3.0.0.31846: all starts work fine, including for unicode text with two- and three- bytes per character.
The text was updated successfully, but these errors were encountered: