Issue Details (XML | Word | Printable)

Key: CORE-3245
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Dmitry Yemanov
Reporter: Paul Vinkenoog
Votes: 0
Watchers: 1
Operations

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

SUBSTRING on long blobs truncates result to 32767 if third argument not present

Created: 18/Nov/10 03:21 AM   Updated: 16/May/12 11:21 AM
Component/s: Engine
Affects Version/s: 2.1.3, 2.5.0
Fix Version/s: 2.5.1, 2.1.5, 3.0 Alpha 1

Time Tracking:
Not Specified

Issue Links:
Relate
 

Planning Status: Unspecified


 Description  « Hide
If the third argument is not present, SUBSTRING should return from <startpos> to the end of the string.

But with long text blobs, it returns a maximum of 32767 characters, as the following query demonstrates:

  with q (s) as (
    select cast(cast('abc' as char(32767)) as blob sub_type text)
             || cast('def' as char(32767))
             || cast('ghi' as char(32767))
             || 'jkl'
    from rdb$database
  ),
  r (sub_for, sub_nofor) as (
    select substring(s from 8000 for 120000),
                substring(s from 8000)
    from q
  )
  select char_length(s), right(s, 3),
              char_length(sub_for), right(sub_for, 3),
              char_length(sub_nofor), right(sub_nofor, 3)
  from q cross join r

The result is (98304, 'jkl', 90305, 'jkl', 32767, ' ').

Columns 5 and 6 should be the same as 3 and 4: 90305, 'jkl'.


 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.