Re: Proposal for resolving casting issues - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Proposal for resolving casting issues
Date
Msg-id 200209171914.g8HJEfW07696@candle.pha.pa.us
Whole thread Raw
In response to Re: Proposal for resolving casting issues  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Proposal for resolving casting issues
List pgsql-hackers
Tom Lane wrote:
> Note that if you write, say,
>     set numericcol = numericcol * 3.14159;
> my proposal would do the "right thing" since the constant would be typed
> as numeric to start with and would stay that way.  To do what you want
> with a float variable, it'd be necessary to write
>     set numericcol = numericcol * float4col::numeric;
> which is sort of ugly; but no uglier than
>     set float4col = float4col * numericcol::float4;
> which is what you'd have to write if the system preferred numeric and
> you wanted the other behavior.

I need a clarification.  In the non-assignment case, does:
WHERE numericcol = numericcol * 3.14159

evaluate "numericcol * 3.14159" as a numeric?

And does:
WHERE 5.55 = numericcol * 3.14159

evaluate "numericcol * 3.14159" as a numeric too?

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Numeric casting rules, take two
Next
From: Tom Lane
Date:
Subject: Re: Proposal for resolving casting issues