FirebirdSQL / firebird

Firebird server, client and tools
https://www.firebirdsql.org/
1.23k stars 212 forks source link

Wrong default collation in where clausule for binary blob [CORE3854] #4195

Closed firebird-automations closed 12 years ago

firebird-automations commented 12 years ago

Submitted by: Richard Stekly (rs.)

database created with charset WIN1250, logged in with default charset WIN1250

table MY_TABLE - MY_FLD blob subtype 0;

working SQL: select * from MY_TABLE where MY_FLD starting with 'kůň' wrong SQL: select * from MY_TABLE where MY_FLD starting with :MY_PARAM PAS code: IBSQL.Prepare; IBSQL.Params[0].asString:='kůň'; IBSQL.ExecQuery;

in 250 returns matching records, in 251 returns nothing. When token 'kůň' is changed to 'horse', it works fine. Workaround is: select * from MY_TABLE where MY_FLD starting with cast(:MY_PARAM as varchar(4096)) I mean it do'nt use charset from login for parameters or works with MY_PARAM binary as-is.

firebird-automations commented 12 years ago

Commented by: @dyemanov

Binary blobs don't have charsets or collations. In v2.5.0 and before, your example described the parameter as VARCHAR. Staring with v2.5.1, it's described as a blob with the same characteristics as the field being compared to, i.e. a binary blob. It is intentional, see CORE3353. So you have to either specify the string type and charset explicitly (cast or whatever) or, much better, use text blobs for strings instead of binary blobs.

firebird-automations commented 12 years ago

Commented by: Sean Leyne (seanleyne)

Collations will never be applicable for binary blobs

firebird-automations commented 12 years ago
Modified by: Sean Leyne (seanleyne) status: Open \[ 1 \] =\> Resolved \[ 5 \] resolution: Won't Fix \[ 2 \]
firebird-automations commented 12 years ago
Modified by: @pcisar status: Resolved \[ 5 \] =\> Closed \[ 6 \]