Subject | RE: [Firebird-devel] RE: [ib-support] Strange query results, based on where clause |
---|---|
Author | Leyne, Sean |
Post date | 2002-03-07T00:52:02Z |
Jim,
Why are the CHAR columns converted to numeric, instead of the numberic
converted to a string?
A CHAR/String type would seem to be the truly common datatype, all
numerics can be expressed as strings but not all strings can be
expressed as a numeric.
Converting a value to the datatype of the table column seems to be the
approach, which should always be used -- it's the approach used for
date/time types. So, why is the reverse used for CHARs?
If the query value had been converted to a string, then both the indexed
and non-indexed would be returned the same result.
The original report was noted because of the inconsistent results.
Sean
> The problem is when a character field is compared to a number.Isn't this the heart of the problem.
> For a non-indexed field, Firebird converts both arguments to
> a common datatype (in this case numeric) and performs the
> comparison.
Why are the CHAR columns converted to numeric, instead of the numberic
converted to a string?
A CHAR/String type would seem to be the truly common datatype, all
numerics can be expressed as strings but not all strings can be
expressed as a numeric.
Converting a value to the datatype of the table column seems to be the
approach, which should always be used -- it's the approach used for
date/time types. So, why is the reverse used for CHARs?
If the query value had been converted to a string, then both the indexed
and non-indexed would be returned the same result.
The original report was noted because of the inconsistent results.
Sean