Re: POWER vs. POW ???

Поиск
Список
Период
Сортировка
От D'Arcy J.M. Cain
Тема Re: POWER vs. POW ???
Дата
Msg-id 20051124071944.310400f5.darcy@druid.net
обсуждение исходный текст
Ответ на POWER vs. POW ???  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Список pgsql-hackers
On Thu, 24 Nov 2005 20:00:21 +0800
Christopher Kings-Lynne <chriskl@familyhealth.com.au> wrote:
> How come these give slightly different results?
> 
> test=# SELECT POW(2,-2);
>   pow
> ------
>   0.25
> (1 row)
> 
> test=# SELECT POWER(2,-2);
>   power
> -------
>    0.25
> (1 row)
> 
> 
> (Note width of result field.)

The width of the label?  Note that the first is controlled by the
result.  The width of the result is four.  Add a padding space on each
end and you get six.  With the second the label (power vs. pow) is
larger than the result so it controls the width.  It is five so add a
padding space on each end and you get seven, one more than the first.
Check these out.

test=# SELECT POW(2,-2) AS REALLY_BIG_LABEL;really_big_label
------------------            0.25
(1 row)

test=# SELECT POWER(2,-2) AS X; x
------0.25
(1 row)

-- 
D'Arcy J.M. Cain <darcy@druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.


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

Предыдущее
От: Christopher Kings-Lynne
Дата:
Сообщение: TRUNC vs. TRUNCATE
Следующее
От: Christopher Kings-Lynne
Дата:
Сообщение: Re: POWER vs. POW ???