Re: AW: type conversion discussion - Mailing list pgsql-hackers

From Tom Lane
Subject Re: AW: type conversion discussion
Date
Msg-id 26719.958399864@sss.pgh.pa.us
Whole thread Raw
Responses Re: AW: type conversion discussion
List pgsql-hackers
Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at> writes:
> I think the topmost numeric-type needs to be numeric, since it is the 
> only type with arbitrary scale and precision.
> Thus I think we would need:
> int2,int4,int8,float4,float8,numeric

No, this is wrong because it contradicts SQL92: float + numeric must
yield float, not numeric.

> But the above is still not correct, in the sence that e.g. int8 cannot be
> converted to float4
> without loss. In that sense I don't think one upward promotion info is
> sufficient.

An important component of the second proposal is that the actual data
conversion is done in one step if possible.  We will *consider* using
float4 before we consider float8, but if we end up using float8 then
we try to do a direct whatever-to-float8 conversion.  So as long as the
right set of conversion operators are available, there's no unnecessary
precision loss.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: type conversion discussion
Next
From: Bruce Momjian
Date:
Subject: Re: Cast of numeric()