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

SUBSTRING on long blobs truncates result to 32767 if third argument not present [CORE3245] #3615

Closed
firebird-automations opened this issue Nov 18, 2010 · 4 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @paulvink

Is related to QA285

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'.

Commits: e43425e c3f23b1 cb34e0c

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

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

resolution: Fixed [ 1 ]

Fix Version: 2.5.1 [ 10333 ]

Fix Version: 3.0 Alpha 1 [ 10331 ]

Fix Version: 2.1.5 [ 10420 ]

assignee: Dmitry Yemanov [ dimitr ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue is related to QA285 [ QA285 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pmakowski

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

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: Done successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment