Issue Details (XML | Word | Printable)

Key: CORE-4781
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Adriano dos Santos Fernandes
Reporter: Pavel Zotov
Votes: 0
Watchers: 0
Operations

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

Maximum string length (32767 bytes) is not validated

Created: 04/May/15 12:19 PM   Updated: 14/Jul/15 04:00 PM
Component/s: Engine
Affects Version/s: 3.0 Beta 1
Fix Version/s: 3.0 Beta 2

File Attachments: 1. Zip Archive DML-blob-literal-65535-vs-65536-characters.zip (5 kB)


QA Status: Done successfully


 Description  « Hide
Consider these statements:

recreate table test(
    id int,
    bf blob
);
commit;
insert into test(id) values(1);
insert into test(id) values(2);
commit;

update test set bf = rpad('',32760, 'ldlkdw89dw89d2kssdjkcsuic3892343kbmvasjhcvsdyucg872348234ejwehsjksi2ljkqwejklwo19ll.ajqa28976a;1kla')
where id = 1;
update test set bf = bf || rpad('',32760, 'ldlkdw89dw89d2kssdjkcsuic3892343kbmvasjhcvsdyucg872348234ejwehsjksi2ljkqwejklwo19ll.ajqa28976a;1kla')
where id = 1;
update test set bf = bf || '1234567890abcdef'
where id = 1;

-- they all works fine, resulting blob will be written so that:
1) it could be displayed later using SET BLOB ALL
2) its octet_length will return proper value (65536).

Now try to continue with following:

update test set bf = ' <character sequence with length = 65536>'
where id = 2;

insert into test(id, bf) values( 3, ' <character sequence with length = 65536>' );
commit;

set blob all;
set list on;
select
    id,
    coalesce(bf, '$$$ NULL $$$') blob_content,
    iif(bf is null, 'is-null!','not-null') bf_is_null,
    octet_length(bf),
    char_length(bf)
from test;

Result will be:

ID 1
BLOB_CONTENT ac:f1
' <character sequence with length = 65536>'
OCTET_LENGTH 65536
CHAR_LENGTH 65536

ID 2
BLOB_CONTENT ac:f0

OCTET_LENGTH 0
CHAR_LENGTH 0

ID 3
BLOB_CONTENT ac:f2

OCTET_LENGTH 0
CHAR_LENGTH 0


PS. Scripts for char_len = 65535 and 65536 bytes (and logs) see in attached file.

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