Page 1 of 1

Invalid input syntax for type numeric

Posted: Mon 13 Apr 2009 12:15
by yapt
Hello,

I have this problem. I have contacted pgdac*devart*com but no answer for the moment....

It is very urgent, because a I have stuck with this..

===================
DROP DOMAIN IF EXISTS otrotpc CASCADE;

CREATE DOMAIN otrotpc AS numeric(8,5)
NULL;

DROP TABLE IF EXISTS test_otrotpc CASCADE;

CREATE TABLE test_otrotpc
( empresa numeric(1),
tpcdto sctest.otrotpc,
CONSTRAINT pk_otrotpc
PRIMARY KEY(empresa)
);

INSERT INTO test_otrotpc VALUES (1,23.48178);

SELECT * FROM test_otrotpc;
===================


Then, put a Win32 VCL form with:
- PgConnection
- PgTable1 (pointing to test_otrotpc)
- PgDataSource1

Drop a DbGrid and a DbNavigator.

And try to insert, on a new line, the values:
empresa = 2
tpcdto = 23,48178 (comma = decimal point)

Then you get a:
EPgError
Invalid input syntax for type numeric: "23,48178"
SQLState: 22P02
procedureName: set_var_from_str
LineNumber: 3023
Position: 0
Severity: Error


I have tried to insert same values with:
* SQL Manager 2007 lite for PostgreSQL
* PgAdmin III
* PostgresDAC 2.4.1 (with same dbgrid/dbnavigator form)

All of them are ok.

It seeems a bug. Somebody can check if it is failing too.

Thanks....

Posted: Tue 14 Apr 2009 09:03
by Plash
We have fixed this problem. The fix will be included in the next build of PgDAC.

Posted: Sun 13 Sep 2009 16:39
by yapt
Hello,

this problem was fixed on a previous version. Now it is again here.

Perhaps I am doing something wrong, could you check where is my fault ?

Thanks...

Posted: Sun 13 Sep 2009 16:44
by yapt
Forget to mention:

It is PostgreSQL 8.4.1

I cannot check if it is running ok with my past versiĆ³n 8.3.x...

Greetings...

Posted: Sun 13 Sep 2009 17:26
by dschuch
I think the reason is the changed behavoir of Numeric Types.

As discussed in my Bug-Report #6158
Hello,

We'll remove quoting in the next PgDAC build.

There is no problem if a quoted value is used in WHERE.

Ticket Details
===================
Ticket ID: 6158
Department: Dac Team
Priority: Medium
Status: On Hold
it is not possible to Quote all numeric types because of errors like
!!!DIFFERENT BEHAVOIR OF "=" AND "LIKE"
template1=# SELECT 1='1';
?column?
----------
t
(1 row)

template1=# SELECT 1 LIKE '1';
ERROR: operator does not exist: integer ~~ unknown at character 10
or
SELECT
:param1*:param2 AS result
:param1(SmallInt)=1
:param2(SmallInt)=2

Error: operator is not unique: "unknown" * "unknown"
so the error has to be cached in the place where the value from the grid is parsed and put into the parameter.

Posted: Sun 13 Sep 2009 19:28
by yapt
Ok... then, what do you mean ?

What is the problem or the solution ?

:-)

PS: Anyway I am discovering a lot of bugs with last version 1.20 that the same application had not with 1.10.0.7

Posted: Sun 13 Sep 2009 19:32
by yapt
Hummmmm.....

same "Invalid input syntax for type numeric" behaviour with 1.10.0.7..

:-O

Posted: Sun 13 Sep 2009 19:48
by dschuch
Ok. Then thats not the reason.
;)

what kind of errors do you found? till now everything is working fine here except the problem
http://www.devart.com/forums/viewtopic.php?t=15807
but it's not really clear if thats a new problem with postgres 8.4 because that error will also occur on command line (plsql)

Posted: Sun 13 Sep 2009 20:18
by yapt
Hummmm....

I think I must clarify my ideas... Perhaps I have had any kind of Brain-Lock but when I have upgrade to 1.20 I have started to get a lot of type errors (Tdatetime vs TPgDateTime, string vs WideString). :-\

I have tried to go back to 1.10 but another and different errors come up.... But I have THE SAME application (replicated a few days ago) on a different computer and all is ok there.....

:-(

I ckeck slowly and I will start to open new posts or support requests.

Thanks and sorry... :-((

Posted: Mon 14 Sep 2009 10:54
by Plash
You should set the UseParamTypes option of TPgQuery to True to work with parameters of domain types.

Posted: Mon 14 Sep 2009 16:07
by yapt
Plash wrote:You should set the UseParamTypes option of TPgQuery to True to work with parameters of domain types.
Thats do the trick.

Thanks a lot again...