Re: New thoughts about indexing cross-type comparisons

Поиск
Список
Период
Сортировка
От Dave Smith
Тема Re: New thoughts about indexing cross-type comparisons
Дата
Msg-id 3F675135.8040306@candata.com
обсуждение исходный текст
Ответ на Re: New thoughts about indexing cross-type comparisons  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: New thoughts about indexing cross-type comparisons  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
My point was that it was inconstant behavour. What exactly are you 
comparing with int2? To me the case without the cast should should throw 
the same error as the statement with the cast.



Tom Lane wrote:
> Dave Smith <dave.smith@candata.com> writes:
> 
>>If this is only dealing with constants, why not just explicitly add a 
>>cast to the constant of the column type at the planner level. It would 
>>solve this problem as well ...
> 
> 
>>create table test (f int2);
>>select * from test where f=cast('1981928928921' as int2);
>>ERROR:  pg_atoi: error reading "1981928928921": Numerical result out of 
>>range
> 
> 
>>  select * from test where f=1981928928921;
>>  f
>>---
>>(0 rows)
> 
> 
> Uh, your own example points out why we can't just insert a cast to int2
> --- it changes the results.  Or am I missing your point?
> 
> (In any case, we aren't necessarily dealing with constants.)
> 
>             regards, tom lane
> 



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: observations about temporary tables and schemas
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Compiling HP-UX 10.20