Re: Is it possible to default all number data to numeric type?
От | Jan Wieck |
---|---|
Тема | Re: Is it possible to default all number data to numeric type? |
Дата | |
Msg-id | 200109041410.f84EAma01655@jupiter.us.greatbridge.com обсуждение исходный текст |
Ответ на | Is it possible to default all number data to numeric type? (plshelpme@my-deja.com (Pls Help Me)) |
Список | pgsql-general |
Pls Help Me wrote: > My company had a old program with written by Powerbuilder. It work > fine in MSSQL 6.5. > Now, my boss required to use another SQL server. Someone told me > PostgreSQL is totally free and powerful. I installed it in a Linux > machine (RedHat 7 + PostgreSQL 7.1.2), and transfer the old data from > MSSQL 6.5 server. It work fine. > However, when I run the old program. When I try to update some record > with numeric type field, it show error as below. > > Unable to identify an operator '=' for types 'numeric' and 'float8'... > You will have to retype this query using an explicit cast. Looks like the application does some SELECT ... WHERE some_numeric_attrib = 1234.56 ... The point here is, that a constant like above (1234.56) get's parsed into a float8 and there is no = operator defined for numeric and float8. It is not sufficient to define an operator, because the conversion of the characters 1234.56 into a float8 value looses precision, so the comparision with a true numeric attribute might result in false, even if it should've been true. > The point is the software house closed, I can't find any programmer. > >_< > So, I want to know is it possible to set the numeric type to default?? > Or any easy way to fix it up? If the vendor doesn't exist any more, I hope you have the sources! If so, you could cast the constant values in the queries explicitly to numeric data type by changing 1234.56 into '1234.56'::numeric. > P.S. My English is bad, pls. forgive me. Compared to what some english native speakers scribble, it's excellent. And this mailing list focuses on solving PostgreSQL problems anyway. As long as we can figure out what someones problem is, noone will complain. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com # _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
В списке pgsql-general по дате отправления: