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

Connection charset not being used anymore on fields with charset NONE [CORE6240] #6484

Closed
firebird-automations opened this issue Jan 30, 2020 · 3 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Rudi Feijó (rudi.feijo_multidadosti.com.br)

On firebird 3.0.3, if I connected to the db specifying a charset like WIN1252, fields with charset NONE would accept a collation of the charset specified in the connection.
This behavior is missing in 3.0.5, if I try to specify a collation in a query, it will throw a "collation x for charset y is not defined", regardless of the connection charset.

CREATE TABLE TEST (
WITHOUT_CHARSET VARCHAR(10)
);

query : SELECT * FROM TEST WHERE without_charset collate WIN_PTBR CONTAINING('abc')

on firebird 3.0.3, without specifiying connection charset : FAIL (COLLATION WIN_PTBR for CHARACTER SET NONE is not defined)
on firebird 3.0.3, specifiying charset WIN1252 on connection : SUCCESS

on firebird 3.0.5, without specifiying connection charset : FAIL (COLLATION WIN_PTBR for CHARACTER SET NONE is not defined)
on firebird 3.0.5, specifiying charset WIN1252 on connection : FAIL (COLLATION WIN_PTBR for CHARACTER SET NONE is not defined)

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

The change was introduced as a side effect of CORE5846 and I think it was a correct change.

The connection charset applies to literals (not this case) and in the last phase, when converting data to be sent to client.

So when you use "field collate ...", the connection charset is not yet applied.

Note also the previous behavior was causing problems, see:

isql -ch utf8 db.fdb
create table test (without_charset varchar(10));
insert into test values ('123áé456'); -- as utf8 charset

select * from test where without_charset collate unicode_ci_ai = '123';

Statement failed, SQLSTATE = 22001
arithmetic exception, numeric overflow, or string truncation
-string right truncation
-expected length 2, actual 8

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

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

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

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

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

No branches or pull requests

1 participant