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

Using binary string literal to assign to user-defined blob sub-types yield conversion error "filter not found to convert type 1 to type -13" [CORE6389] #2352

Closed
firebird-automations opened this issue Aug 16, 2020 · 7 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @mrotteveel

Attempts to assign a binary string-literal value to a user-defined blob sub-type yields a conversion error.

SQL> create table blob13(id integer generated by default as identity primary key, blobfield blob sub_type -13);
SQL> insert into blob13 (blobfield) values (x'ab01');
Statement failed, SQLSTATE = HY000
filter not found to convert type 1 to type -13
SQL>

Workaround: add an explicit cast to either blob sub_type binary or blob sub_type -13

It looks like binary string literals (character set OCTETS) are handled like normal strings, and therefor coerced to blob sub_type text, while they should be coerced to blob sub_type binary instead (which would then allow them to be applied to a user-defined sub-type like sub_type -13 without issue).

Commits: ca049a7

@firebird-automations
Copy link
Collaborator Author

Modified by: @mrotteveel

description: Attempts to assign a value to an user-defined blob sub-type yields a conversion error.

SQL> create table blob13(id integer generated by default as identity primary key, blobfield blob sub_type -13);
SQL> insert into blob13 (blobfield) values (x'ab01');
Statement failed, SQLSTATE = HY000
filter not found to convert type 1 to type -13
SQL>

Workaround: add an explicit cast to either blob sub_type binary or blob sub_type -13

It looks like binary string literals are handled like normal strings, and therefor coerced to blob sub_type text, while they should be coerced to blob sub_type binary instead.

=>

Attempts to assign a value to a user-defined blob sub-type yields a conversion error.

SQL> create table blob13(id integer generated by default as identity primary key, blobfield blob sub_type -13);
SQL> insert into blob13 (blobfield) values (x'ab01');
Statement failed, SQLSTATE = HY000
filter not found to convert type 1 to type -13
SQL>

Workaround: add an explicit cast to either blob sub_type binary or blob sub_type -13

It looks like binary string literals are handled like normal strings, and therefor coerced to blob sub_type text, while they should be coerced to blob sub_type binary instead (which would then allow them to be applied to a user-defined sub-type like sub_type -13 without issue).

@firebird-automations
Copy link
Collaborator Author

Modified by: @mrotteveel

description: Attempts to assign a value to a user-defined blob sub-type yields a conversion error.

SQL> create table blob13(id integer generated by default as identity primary key, blobfield blob sub_type -13);
SQL> insert into blob13 (blobfield) values (x'ab01');
Statement failed, SQLSTATE = HY000
filter not found to convert type 1 to type -13
SQL>

Workaround: add an explicit cast to either blob sub_type binary or blob sub_type -13

It looks like binary string literals are handled like normal strings, and therefor coerced to blob sub_type text, while they should be coerced to blob sub_type binary instead (which would then allow them to be applied to a user-defined sub-type like sub_type -13 without issue).

=>

Attempts to assign a value to a user-defined blob sub-type yields a conversion error.

SQL> create table blob13(id integer generated by default as identity primary key, blobfield blob sub_type -13);
SQL> insert into blob13 (blobfield) values (x'ab01');
Statement failed, SQLSTATE = HY000
filter not found to convert type 1 to type -13
SQL>

Workaround: add an explicit cast to either blob sub_type binary or blob sub_type -13

It looks like binary string literals (character set OCTETS) are handled like normal strings, and therefor coerced to blob sub_type text, while they should be coerced to blob sub_type binary instead (which would then allow them to be applied to a user-defined sub-type like sub_type -13 without issue).

@firebird-automations
Copy link
Collaborator Author

Modified by: @mrotteveel

description: Attempts to assign a value to a user-defined blob sub-type yields a conversion error.

SQL> create table blob13(id integer generated by default as identity primary key, blobfield blob sub_type -13);
SQL> insert into blob13 (blobfield) values (x'ab01');
Statement failed, SQLSTATE = HY000
filter not found to convert type 1 to type -13
SQL>

Workaround: add an explicit cast to either blob sub_type binary or blob sub_type -13

It looks like binary string literals (character set OCTETS) are handled like normal strings, and therefor coerced to blob sub_type text, while they should be coerced to blob sub_type binary instead (which would then allow them to be applied to a user-defined sub-type like sub_type -13 without issue).

=>

Attempts to assign a binary string-literal value to a user-defined blob sub-type yields a conversion error.

SQL> create table blob13(id integer generated by default as identity primary key, blobfield blob sub_type -13);
SQL> insert into blob13 (blobfield) values (x'ab01');
Statement failed, SQLSTATE = HY000
filter not found to convert type 1 to type -13
SQL>

Workaround: add an explicit cast to either blob sub_type binary or blob sub_type -13

It looks like binary string literals (character set OCTETS) are handled like normal strings, and therefor coerced to blob sub_type text, while they should be coerced to blob sub_type binary instead (which would then allow them to be applied to a user-defined sub-type like sub_type -13 without issue).

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

Fix Version: 4.0 RC 1 [ 10930 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: No test => Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

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