integer square root function proposed

Поиск
Список
Период
Сортировка
От Martin L. Buchanan
Тема integer square root function proposed
Дата
Msg-id CAPfd9Mm5rh3TfW_frM4q7tmidM39_ezBQuYJXXf8ff6Y8_jSCQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: integer square root function proposed  (Rob Sargent <robjsargent@gmail.com>)
Re: integer square root function proposed  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Dear PostgreSQL colleagues:

I have just joined this, my first PG mailing list.

Reading the documentation I found no built-in function for integer square root, requiring a sequence of:

floor(sqrt(foo))::integer

to go from an integer to the integer square root as an integer.

If PG leaders smile on this suggestion, could we have isqrt(foo) where foo has a numeric type and the result type is the same numeric type, with the result type being the integer square root for foo >= 0 and producing an error if negative? (And with infinities and NaNs processed as described in 8.1 Numeric Types).

I did not see an explicit enhancement request list in the PG mailing lists. Recommendations for a more specific list to post this to are welcome.


Sincerely,

Martin L. Buchanan
software developer
Laramie, WY, USA


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

Предыдущее
От: Michael Arnold
Дата:
Сообщение: Re: Postgres Date Type Value
Следующее
От: Rob Sargent
Дата:
Сообщение: Re: integer square root function proposed