Search Postgresql Archives

Re: numeric cast oddity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sim Zacks <sim@xxxxxxxxxxxxxx> 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)::numeric(20,4)
is known to have typmod (20,4), because the cast operation enforces it.
	- (1::numeric(20,4))
is not known to have any particular typmod --- it actually does fit in
(20,4), of course, but that fact depends on the detailed behavior of the
minus operator, which is not known to the type machinery.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux