Re: New thoughts about indexing cross-type comparisons

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: New thoughts about indexing cross-type comparisons
Дата
Msg-id 24602.1063736363@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: New thoughts about indexing cross-type comparisons  (Dave Smith <dave.smith@candata.com>)
Ответы Re: New thoughts about indexing cross-type comparisons  (Kevin Brown <kevin@sysexperts.com>)
Список pgsql-hackers
Dave Smith <dave.smith@candata.com> writes:
> 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.

> select * from test where f=1981928928921;

I contend not.  The above is perfectly well defined.  It will always
return false if f is int2, but that does not mean it should throw an
error instead.  In any standard programming language, you'd resolve
the operator by up-converting f to the type of the constant, not by
trying to down-convert the wider value.  PG happens to have
implementation reasons to wish to use the variable's datatype instead
of the constant's, but that doesn't excuse us from obeying the ordinary
laws of arithmetic.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: massive quotes?
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: [BUGS] pg_dump/all doesn't output schemas correctly