Sim Zacks writes:
> If I replace that column with -1::numeric(20,4) or - (1::numeric(20,4))
> the type that goes to the view is numeric without any scale or precision
> and then I get an error that I cannot change the column type.
You've still got the order of operations wrong.
(-1)::nume
As I mentioned, it is more then just a headers issue it is a type issue.
I have a view that has a column of type numeric(20,4)
If I replace that column with -1::numeric(20,4) or - (1::numeric(20,4))
the type that goes to the view is numeric without any scale or precision
and then I get an error t
I wrote:
> which are indeed different (might be worth looking into why)
Oh: the reason they're different is that these expressions are not
actually the same thing. Minus binds less tightly than typecast.
You get consistent results if you input equivalent expressions:
regression=# select cast(-1
Scott Marlowe writes:
> On Thu, Dec 3, 2009 at 8:03 AM, Tom Lane wrote:
>> Really? Your example doesn't seem to show that.
> I think he's talking about the headers
The headers I get are
regression=# select -1::numeric(20,4);
?column?
--
-1.
(1 row)
regression=# select cast(-1
It is more then just a
headers issue. I have a view that has a column of type numeric(20,4).
I modified the view and
added a union which cast an integer as a numeric(20,4) using the ::
notation.
I received an error
stating that I could not change the column type.
When I used the cast
function n
On Thu, Dec 3, 2009 at 8:03 AM, Tom Lane wrote:
> Sim Zacks writes:
>> 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.
>
> Really? Your example doesn't se
Sim Zacks writes:
> 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.
Really? Your example doesn't seem to show that.
regards, tom la
2009/12/3 Sim Zacks
> 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.
>
> Sim
>
> select version();
> "PostgreSQL 8.3.5 on i586-pc-linux-gnu, compiled by GCC
2009/12/3 Sim Zacks
> 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.
>
> Sim
>
> select version();
> "PostgreSQL 8.3.5 on i586-pc-linux-gnu, compiled by GCC