Re: numeric cast oddity

From: Sim Zacks <sim(at)compulab(dot)co(dot)il>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org, Sandy Oz <alexandra(at)compulab(dot)co(dot)il>
Subject: Re: numeric cast oddity
Date: 2009-12-03 15:55:20
Message-ID: 4B17DF68.2020508@compulab.co.il
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html style="direction: ltr;">
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body style="direction: ltr;" bgcolor="#ffffff" text="#000000">
<p style="margin-bottom: 0cm; margin-top: 0pt;">It is more then just a
headers issue. I have a view that has a column of type numeric(20,4).</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;">I modified the view and
added a union which cast an integer as a numeric(20,4) using the ::
notation.</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;">I received an error
stating that I could not change the column type.</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;">When I used the cast
function notation it allowed it through.</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;"><br>
</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;">The fact that it
actually converts it to numeric(20,4) doesn't help me if the view
thinks that it is a regular numeric.</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;"><br>
</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;">Sim<br>
</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;"><br>
</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;"><br>
</p>
<p style="margin-bottom: 0cm; margin-top: 0pt;">Scott Marlowe wrote:<br>
</p>
<blockquote
cite="mid:dcc563d10912030749r2bc35040qd42da5b29c37193f(at)mail(dot)gmail(dot)com"
type="cite">
<pre wrap="">On Thu, Dec 3, 2009 at 8:03 AM, Tom Lane <a class="moz-txt-link-rfc2396E" href="mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us">&lt;tgl(at)sss(dot)pgh(dot)pa(dot)us&gt;</a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Sim Zacks <a class="moz-txt-link-rfc2396E" href="mailto:sim(at)compulab(dot)co(dot)il">&lt;sim(at)compulab(dot)co(dot)il&gt;</a> writes:
</pre>
<blockquote type="cite">
<pre wrap="">When I cast an integer to numeric using :: notation it ignores the scale
and precision that I specify, but when I use the cast function it uses
the scale and precision that I specify.
</pre>
</blockquote>
<pre wrap="">Really? &nbsp;Your example doesn't seem to show that.
</pre>
</blockquote>
<pre wrap=""><!---->
I think he's talking about the headers
</pre>
</blockquote>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 2.2 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2009-12-03 15:56:32 Re: [Bacula-users] Catastrophic changes to PostgreSQL 8.4
Previous Message Craig Ringer 2009-12-03 15:54:34 Re: [Bacula-users] Catastrophic changes to PostgreSQL 8.4