Re: integer instead of 'double precision'?

Поиск
Список
Период
Сортировка
От Willy-Bas Loos
Тема Re: integer instead of 'double precision'?
Дата
Msg-id CAHnozTi+Hf2A_TyUD_LqjyWXYCJUvX_LJg=4oqS+n447MUvWfw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: integer instead of 'double precision'?  (Guillaume Lelarge <guillaume@lelarge.info>)
Ответы Re: integer instead of 'double precision'?  (Chris Angelico <rosuav@gmail.com>)
Re: integer instead of 'double precision'?  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-general
On Fri, Sep 9, 2011 at 5:09 PM, Guillaume Lelarge <guillaume@lelarge.info> wrote:
You divide an integer with an integer, that should give you an integer.

Can you tell me the reasoning behind that idea?
Is it a rule that the output type of an operator must equal the input type?
In this case that doesn't seem locigal. I think that the "/" operator should return something that allows fractions, since the operator creates fractions so frequently.
If you should need it to be an integer, e.g. when you update an integer column, casting should  be done just-in-time.

But i don't know much about the internals and the reasoning behind these matters, i would be grateful if you could explain.

Cheers,

WBL

--
"Quality comes from focus and clarity of purpose" -- Mark Shuttleworth

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

Предыдущее
От: Ivan Voras
Дата:
Сообщение: PostgreSQL and a clustered file system
Следующее
От: Chris Angelico
Дата:
Сообщение: Re: integer instead of 'double precision'?