pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #7807: "sign" function returns double
2+ messages / 2 participants
[nested] [flat]

* BUG #7807: "sign" function returns double
@ 2013-01-14 14:21 a_rares@yahoo.com
  2013-01-14 18:07 ` Re: BUG #7807: "sign" function returns double Heikki Linnakangas <hlinnakangas@vmware.com>
  0 siblings, 1 reply; 2+ messages in thread

From: a_rares@yahoo.com @ 2013-01-14 14:21 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      7807
Logged by:          Andrei Rares
Email address:      a_rares@yahoo.com
PostgreSQL version: 9.1.7
Operating system:   GNU/Linux 3.2.0-35-generic x86_64
Description:        

In the documentation
(http://www.postgresql.org/docs/9.1/static/functions-math.html) it is
written that the return type is the same as the input, but a query like
'select sign(1::int)' returns a double



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #7807: "sign" function returns double
  2013-01-14 14:21 BUG #7807: "sign" function returns double a_rares@yahoo.com
@ 2013-01-14 18:07 ` Heikki Linnakangas <hlinnakangas@vmware.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Heikki Linnakangas @ 2013-01-14 18:07 UTC (permalink / raw)
  To: a_rares@yahoo.com; +Cc: pgsql-bugs

On 14.01.2013 16:21, a_rares@yahoo.com wrote:
> In the documentation
> (http://www.postgresql.org/docs/9.1/static/functions-math.html) it is
> written that the return type is the same as the input, but a query like
> 'select sign(1::int)' returns a double

It says that the input type is "dp or numeric", which means "double or 
numeric". So there are two overloaded functions called sign, 
sign(double), and sign(numeric). When the doc says that the return type 
is the same as input, it means that the return type is double, if you 
call sign(double), and numeric if you call sign(numeric). There is no 
sign(int) function, so the input "1::int" is cast to double, and the 
return type is also a double.

- Heikki


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2013-01-14 18:07 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-01-14 14:21 BUG #7807: "sign" function returns double a_rares@yahoo.com
2013-01-14 18:07 ` Heikki Linnakangas <hlinnakangas@vmware.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox