pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Petr Fedorov <petr.fedorov@phystech.edu>
To: pgsql-bugs@postgresql.org
Subject: Precision/scale of a numeric attribute of a new data type are not handled correctly when the type is returned by a function
Date: Sun, 24 Nov 2019 17:10:33 +0300
Message-ID: <b2dbfbd0-8f12-4cca-a0b5-9ee3f00385b4@phystech.edu> (raw)

Hello,

Steps to reproduce:


create type public.test_type as (  value1 numeric(35,6),     value2
numeric(35,6) );

create or replace function public.test(    )    returns test_type   
language  'sql'  as $body$   select 7.136178319899999964,
7.136178319899999964;  $body$;


select value1, value2 from test();

Expected:  7.136178 7.136178

Actual:  7.136178319899999964 7.136178319899999964


select value1::numeric(35,6), value2::numeric(35,2) from test();

Expected:  7.136178 7.14

Actual: 7.136178319899999964 7.14


I'm on Centos 7,  Postgresql 11.6



   







view thread (2+ messages)  latest in thread

Message-ID: <b2dbfbd0-8f12-4cca-a0b5-9ee3f00385b4@phystech.edu>
Permalink:  ../b2dbfbd0-8f12-4cca-a0b5-9ee3f00385b4@phystech.edu/
Also on:    postgresql.org/message-id/b2dbfbd0-8f12-4cca-a0b5-9ee3f00385b4@phystech.edu

 · 

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: petr.fedorov@phystech.edu
  Subject: Re: Precision/scale of a numeric attribute of a new data type are not handled correctly when the type is returned by a function
  In-Reply-To: <b2dbfbd0-8f12-4cca-a0b5-9ee3f00385b4@phystech.edu>
  References: <b2dbfbd0-8f12-4cca-a0b5-9ee3f00385b4@phystech.edu>

* 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