pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: rschaaf@commoninf.com
To: pgsql-bugs@postgresql.org
Subject: BUG #12885: The result of casting a double to an integer depends on the database version
Date: Fri, 20 Mar 2015 19:43:37 +0000
Message-ID: <20150320194337.2573.72944@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      12885
Logged by:          Rich Schaaf
Email address:      rschaaf@commoninf.com
PostgreSQL version: 9.4.1
Operating system:   Windows 7
Description:        

The result returned by the following query appears to depend on the
PostgreSQL database version.

The query is:
select column1 AS double_value, cast(column1 AS INT) AS int_value
  from (VALUES (-2.5::double precision),
               (-1.5::double precision),
               (-0.5::double precision),
               (0.5::double precision),
               (1.5::double precision),
               (2.5::double precision)) t;

In PostgreSQL 9.3.5, the query returns:
double_value, int_value
  -2.5, -3
  -1.5, -2
  -0.5, -1
  0.5, 1
  1.5, 2
  2.5, 3

PostgreSQL 9.4.1, the query returns:
  -2.5, -2
  -1.5, -2
  -0.5, 0
  0.5, 0
  1.5, 2
  2.5, 2


-- 
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 (31+ messages)  latest in thread

Message-ID: <20150320194337.2573.72944@wrigleys.postgresql.org>
Permalink:  ../20150320194337.2573.72944@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20150320194337.2573.72944@wrigleys.postgresql.org

 · 

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: rschaaf@commoninf.com
  Subject: Re: BUG #12885: The result of casting a double to an integer depends on the database version
  In-Reply-To: <20150320194337.2573.72944@wrigleys.postgresql.org>
  References: <20150320194337.2573.72944@wrigleys.postgresql.org>

* 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