Precision/scale of a numeric attribute of a new data type are not handled correctly when the type is returned by a function

From: Petr Fedorov <petr(dot)fedorov(at)phystech(dot)edu>
To: pgsql-bugs(at)postgresql(dot)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: 2019-11-24 14:10:33
Message-ID: b2dbfbd0-8f12-4cca-a0b5-9ee3f00385b4@phystech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

   

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-11-24 17:38:50 Re: BUG #16134: Assertion fails on CREATE gist INDEX over intarray
Previous Message PG Bug reporting form 2019-11-24 07:33:34 BUG #16134: Assertion fails on CREATE gist INDEX over intarray