Issue Details (XML | Word | Printable)

Key: CORE-3228
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Adriano dos Santos Fernandes
Reporter: Paul Vinkenoog
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Firebird Core

RIGHT() fails with multibyte text blobs > 1024 chars

Created: 11/Nov/10 05:01 PM   Updated: 03/May/11 06:43 AM
Component/s: Engine
Affects Version/s: 2.1.3, 2.5.0
Fix Version/s: 2.1.4, 2.5.1, 3.0 Alpha 1

Time Tracking:
Not Specified

Issue Links:
Relate
 

Planning Status: Unspecified


 Description  « Hide
This code, calling RIGHT() on a 1024-char UTF8 blob:

    with q (s) as (
        select
            cast(
                cast('AAA' as char(1021)) || 'ZZZ'
            as blob sub_type text character set utf8
        )
        from rdb$database
    )
    select right(s, 3) from q

returns 'ZZZ' (OK)

If I make it a 1025-char blob:

    with q (s) as (
        select
            cast(
                cast('AAA' as char(1022)) || 'ZZZ'
            as blob sub_type text character set utf8
        )
        from rdb$database
    )
    select right(s, 3) from q

the result is

    335544321
    arithmetic exception, numeric overflow, or string truncation
    Cannot transliterate character between character sets

With CHAR type UTF8 strings, this error doesn't happen.

With single-byte charsets, RIGHT() works correctly with text blobs of any size (also > 32K).

LEFT() does not have this bug, and functions correctly with multi-byte charset text blobs of any size.


 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Philippe Makowski added a comment - 03/May/11 06:43 AM
Q/A test made