Alex,

> Hi All,
> 
> I have found strange behaviour concerning trailing spaces - following 
> strings are equal:
> 
> 'ABC   ' = 'ABC'
> 
> You can try the following query:
> 
> /select/
> /  case when 'ABC   ' = 'ABC' then 1 else 0 end,/
> /  case when cast('ABC   ' as varchar(10)) = cast('ABC' as varchar(10)) 
> then 1 else 0 end,/
> /  char_length('ABC   '),/
> /  char_length('ABC')/
> /from/
> /  rdb$database/
> 
> This query was tested on FB v.1.5.6, 2.5.8 & 3.0.3 - while char length 
> (or strlen on 1.5) is different, the strings are always equal.
> 
> Is this by design :)

Additionally to Dimitry's reply.

If you need a reliable way for comparison and want to treat trailing 
spaces as different, check out the IS [NOT] DISTINCT FROM clause.

https://firebirdsql.org/refdocs/langrefupd21-distinct.html



-- 
With regards,
Thomas Steinmaurer
http://www.upscene.com/

Professional Tools and Services for Firebird
FB TraceManager, IB LogManager, Database Health Check, Tuning etc.

Reply via email to