pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: a_rares@yahoo.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7807: "sign" function returns double
Date: Mon, 14 Jan 2013 20:07:29 +0200
Message-ID: <50F44961.2020305@vmware.com> (raw)
In-Reply-To: <E1TukuS-0002HE-AA@wrigleys.postgresql.org>
References: <E1TukuS-0002HE-AA@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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



view thread (2+ messages)

Message-ID: <50F44961.2020305@vmware.com>
Permalink:  ../50F44961.2020305@vmware.com/
Also on:    postgresql.org/message-id/50F44961.2020305@vmware.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: hlinnakangas@vmware.com, a_rares@yahoo.com
  Subject: Re: BUG #7807: "sign" function returns double
  In-Reply-To: <50F44961.2020305@vmware.com>
  References: <E1TukuS-0002HE-AA@wrigleys.postgresql.org> <50F44961.2020305@vmware.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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