|Subject||Re: [firebird-support] Autotrim?|
> On Fri, 02 Mar 2012 09:03:02 +0100, Mark Rotteveel<mark@...>It doesn't.
>> On Tue, 28 Feb 2012 07:37:59 -0000, "syn.erpy"<syn.erpy@...>
>>> we ran into a little problem regarding blanks.
>>> Try the following code (FB 2.5.1):
>>> create exception blank 'blank';
>>> SET TERM ^ ;
>>> create OR alter procedure p_test
>>> IF (' ' = '') THEN
>>> exception blank;
>>> SET TERM ; ^
>>> execute procedure p_test;
>>> If you run it, the exception is raised. My question is why Firebird
>>> that a blank (or two or three or four for that matter) is the same as
>>> empty string. Is this a bug or an intended feature?
>> Because that is what the SQL standard defines: When comparing strings
>> shorter string is padded with spaces to the length of the longer string,
>> and then they are compared. So if two strings have the same prefix and
>> rest is a (different) number of spaces, then they are still considered
> I am not 100% sure (and no Firebird installation at hand to check), but I
> believe ' ' IS DISTINCT FROM '' should work.
select 1 from rdb$database where '' is distinct from ' '
gives an empty result set.
select 1 from rdb$database where '' is not distinct from ' '
Tested with Firebird 2.5.0.
Thomas Steinmaurer (^TS^)
Firebird Technology Evangelist
Do you care about the future of Firebird? Join the Firebird Foundation: