On Thu, 24 Nov 2005 20:00:21 +0800
Christopher Kings-Lynne <[EMAIL PROTECTED]> 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.

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to