Re: Proposal for resolving casting issues

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Zeugswetter Andreas SB SD <ZeugswetterA(at)spardat(dot)at>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proposal for resolving casting issues
Date: 2002-09-17 19:14:41
Message-ID: 200209171914.g8HJEfW07696@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-09-17 19:26:20 Re: Proposal for resolving casting issues
Previous Message Tom Lane 2002-09-17 18:57:12 Numeric casting rules, take two