Skip to content
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

Truncation of strings to put in MON$ tables do not work correctly [CORE6419] #6657

Closed
firebird-issue-importer opened this issue Oct 18, 2020 · 12 comments

Comments

@firebird-issue-importer

Submitted by: @asfernandes

Relate to CORE6414
Relate to CORE6415
Relate to CORE6248

This is related to CORE6248.

Multibyte character set strings may be split in the middle of a character raising errors instead of truncation.

Also see this test case which generate error instead of truncation:

select rdb$set_context('USER_SESSION', '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890', '1') from rdb$database;
select MON$VARIABLE_NAME from mon$context_variables;

Statement failed, SQLSTATE = 22001
arithmetic exception, numeric overflow, or string truncation
-string right truncation
-expected length 80, actual 90

Commits: 0174bda

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 18, 2020

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 18, 2020

Modified by: @asfernandes

Link: This issue relate to CORE6414 [ CORE6414 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 18, 2020

Modified by: @asfernandes

Link: This issue relate to CORE6415 [ CORE6415 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 18, 2020

Modified by: @asfernandes

Link: This issue relate to CORE6248 [ CORE6248 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 18, 2020

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 RC 1 [ 10930 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 19, 2020

Commented by: @pavel-zotov

Consider following script:

set list on;
set count on;
set term ^;
execute block as
begin
rdb$set_context('USER_SESSION', '12345678901234567890123456789012345678901234567890123456789012345678901234567890abcdefghij', '1');
rdb$set_context('USER_SESSION', 'ASDFGHJKLP€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€', '1');
end
^
set term ;^

select
c.mon$variable_name as mon_context_name
,octet_length(c.mon$variable_name) mon_context_length
from mon$context_variables c
where mon$variable_name starting with '1234567890'
;

select
c.mon$variable_name as mon_context_name
,octet_length(c.mon$variable_name) mon_context_length
from mon$context_variables c
where mon$variable_name starting with 'ASDFGHJKLP€€€'
;

Being tested on 4.0.0.2228, it issues:

1) expected result for context variable = '1234567890...' ,i.e. it truncates it to 80 octets:

MON_CONTEXT_NAME 12345678901234567890123456789012345678901234567890123456789012345678901234567890
MON_CONTEXT_LENGTH 80

2) string which is cuted on some position where 'euro' character must be:

MON_CONTEXT_NAME ASDFGHJKLP€€€€€€€€€€€€€€€€€€€€€€€�
MON_CONTEXT_LENGTH 80

Is it OK ?

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 19, 2020

Commented by: @pavel-zotov

PS.

On 4.0.0.2225 second query ( "... where mon$variable_name starting with 'ASDFGHJKLP€€€' ) issues expected result:

Statement failed, SQLSTATE = 22001
arithmetic exception, numeric overflow, or string truncation
-string right truncation
-expected length 80, actual 90

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 19, 2020

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Deferred

Test Details: See notes of 19.10.2020 09:30. Waiting for reply.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 21, 2020

Commented by: @asfernandes

> 2) string which is cuted on some position where 'euro' character must be:
>
> MON_CONTEXT_NAME ASDFGHJKLP€€€€€€€€€€€€€€€€€€€€€€€�
> MON_CONTEXT_LENGTH 80
>
> Is it OK ?

Yes, considering that mon$variable_name uses charset NONE.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 21, 2020

Commented by: @asfernandes

> On 4.0.0.2225 second query ( "... where mon$variable_name starting with 'ASDFGHJKLP€€€' ) issues expected result:
>
> Statement failed, SQLSTATE = 22001
> arithmetic exception, numeric overflow, or string truncation
> -string right truncation
> -expected length 80, actual 90

So it was a bug.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 21, 2020

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: Deferred => Done successfully

Test Details: See notes of 19.10.2020 09:30. Waiting for reply. =>

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 21, 2020

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants