Re: [BUGS] numerics lose scale and precision in views of unions

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Brian C(dot) DeRocher" <brian(dot)derocher(at)mitretek(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [BUGS] numerics lose scale and precision in views of unions
Date: 2006-08-09 23:48:04
Message-ID: 20060809234804.GO20016@kenobi.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

* Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> "Brian C. DeRocher" <brian(dot)derocher(at)mitretek(dot)org> writes:
> > It appears that when you create a view of a union, numeric data types
> > loose their scale and precision.
>
> I think this is the same issue discussed here:
> http://archives.postgresql.org/pgsql-hackers/2004-12/msg00408.php
>
> That was just before 8.0 release, so the change got postponed and then
> seems to have slipped through the cracks :-(. Any objections to
> fixing it for 8.2?

Sounds good to me. I'd like to talk a bit about the expected behavior
of a numeric hash function. This is the current behavior:

abc=# select * from test1;
a1
--------
1.00
1.0000
1.0
(3 rows)

abc=# select * from test1 group by a1;
a1
------
1.00
(1 row)

abc=# select distinct a1 from test1;
a1
------
1.00
(1 row)

I just want to double-check that this is the correct/expected behavior
(hopefully from the SQL spec?) and that a hash function need not concern
itself with the scale?

I'm guessing it's too late for 8.2, or would such a relatively
isolated/simple change be acceptable during the beta period (adding hash
functions for numeric types)? Don't swear I'll actually get to them but
I'd like to and so I'd like to be hash out (hah!) the correct semantics.

Thanks!

Stephen

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-08-10 00:12:17 Re: [BUGS] numerics lose scale and precision in views of unions
Previous Message Jim C. Nasby 2006-08-09 22:59:42 Re: [BUGS] BUG #2560: Web page documentation hard to use

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-08-09 23:52:47 Re: Buildfarm failure on ecpg/test/pgtypeslib
Previous Message Jim C. Nasby 2006-08-09 23:30:09 Re: Buildfarm failure on ecpg/test/pgtypeslib