Re: Odd numeric->float4/8 casting behaviour - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: Odd numeric->float4/8 casting behaviour
Date
Msg-id 87ps9uvjuo.fsf@enterprisedb.com
Whole thread Raw
In response to Re: Odd numeric->float4/8 casting behaviour  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Odd numeric->float4/8 casting behaviour  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
"Tom Lane" <tgl@sss.pgh.pa.us> writes:

> Gregory Stark <stark@enterprisedb.com> writes:
>> I believe this is happening because the numeric is being cast to float8 and
>> then the float4-float8 cross-data-type operator is being used. It seems like
>> it would be preferable to cast it to float4 and use the non-cross-data-type
>> operator. They're both marked as implicit casts so I'm unclear what decides
>> which gets used.
>
> Without having traced through the code, I think the fact that float8 is
> a "preferred type" is driving it.  It's not clear whether we could
> change this without getting into a "can't resolve ambiguous operator"
> problem.

This is pre-operator-families, I thought "preferred type" was new with them.

Perhaps we should have preferred operators rather than preferred types?

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Odd numeric->float4/8 casting behaviour
Next
From: Markus Schiltknecht
Date:
Subject: Re: InitPostgres and flatfiles question