Thread: Is it possible to default all number data to numeric type?
Is it possible to default all number data to numeric type?
From
plshelpme@my-deja.com (Pls Help Me)
Date:
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. 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? P.S. My English is bad, pls. forgive me.
You can create an '=' operator for those two types. Look at the "CREATE OPERATOR" command, listed in the "SQL Commands" section of the Reference Manual. That manual comes with your distribution, and also can be accessed via any of the PostgreSQL mirror sites (check www.postgresql.org to find one near you). ----- Original Message ----- From: "Pls Help Me" <plshelpme@my-deja.com> To: <pgsql-general@postgresql.org> Sent: Wednesday, August 29, 2001 5:13 AM Subject: [GENERAL] Is it possible to default all number data to numeric type? > 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. > > 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? > > P.S. My English is bad, pls. forgive me. > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html > >
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