Re: 'Clever' behaviour
Posted in 1996
Nick Nobbe (nnob@loc.gov) wrote:
> On 25 Jun 1996, Mike Johnson wrote:
> > If you query against a char index field with an integer, Informix
> > (5.03) tries to be 'clever' and convert your char index to an integer
> > index in a desparate attempt to satisfy the query.
> >
> > The biggest problem with this is the amount of time that it takes
> > to do this. (Longer than a sequential scan would take!)
> >
> > My question is: Does anyone know how to turn off this feature? I would
> > rather the server says 'not found' if an application accidently
> > were to perform such a query.
> >
> Mike,
> Don't bother. Feed it char and it will work like a charm. I
> discovered this when we upgraded from 4.x to 5.x. In version
> 4.x, it didn't seem to matter what type value you compared with.
> Yours,
> Nick
> *********************************
> Nick Nobbe, Library of Congress
> NLS/BPH
> mail: nnob@loc.gov
> *********************************
Which is to say "Remember your quotes or suffer the consequences!" I too
wish there were a way to control how Informix will try to assume what
we mean and let us define certain rules for implicit type conversion. We
have lost a lot of time chasing subtle bugs like the queries below. They
both parse just fine but they return different results.
select * from stores:orders where order_date = 07/24/1994 ;
select * from stores:orders where order_date = '07/24/1994';
Ken Miles
kenm@vcd.hp.com
Opinions my own and all other standard disclaimers.