Issue Details (XML | Word | Printable)

Key: CORE-6297
Type: Improvement Improvement
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: Pavel Zotov
Votes: 0
Watchers: 2
Operations

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

Attempt to violate constraint for domain-based BLOB field raises message that does not relates to actual problem

Created: 05/May/20 06:59 PM   Updated: 05/May/20 07:09 PM
Component/s: Engine
Affects Version/s: None
Fix Version/s: None

QA Status: No test


 Description  « Hide
Consider script (i've checked on 2.5.9, 3.0.6 and 4.0.0 -- result the same):
=======
-- set names utf8;
shell del c:\temp\tmp4t_blob.fdb 2>nul;
create database 'localhost:c:\temp\tmp4t_blob.fdb' user 'SYSDBA' password 'masterkey';
show version;

set blob all;
set list on;

create domain dm_char as varchar(1) default 'W' check( value in ('W', 'R') );
create domain dm_blob as blob sub_type text default 'W' check( value in ('W', 'R') );

recreate table t_char( fld_char dm_char );
recreate table t_blob( fld_blob dm_blob );
commit;

insert into t_char default values returning fld_char;
insert into t_blob default values returning fld_blob;
rollback;

alter domain dm_char set default 'A'; -- new default value VIOLATES domain constraint
alter domain dm_blob set default 'A'; -- new default value VIOLATES domain constraint

insert into t_char default values returning fld_char; -- [ 1 ]
insert into t_blob default values returning fld_blob; -- [ 2 ]
rollback;
=======

Statement marked as [ 1 ] raises: "SQLSTATE = 23000 ... for column "T_CHAR"."FLD_CHAR", value "A", i.e. all OK
Statement marked as [ 2 ] raises: "SQLSTATE = 22018 / conversion error from string "BLOB"", but character 'A' belongs to the same ASCII-list as those which are in CHECK-list: 'W' , R'


IMO, it will be good if message in this case will be equal to [ 1 ].


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Dimitry Sibiryakov added a comment - 05/May/20 07:08 PM - edited
It would require to implement implicit cast from BLOB to varchar. The error you see is exactly result of the attempt to show content of BLOB in message.