Invalid input syntax for type numeric

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
yapt
Posts: 69
Joined: Mon 16 Mar 2009 12:06

Invalid input syntax for type numeric

Post by yapt » Mon 13 Apr 2009 12:15

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....

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 14 Apr 2009 09:03

We have fixed this problem. The fix will be included in the next build of PgDAC.

yapt
Posts: 69
Joined: Mon 16 Mar 2009 12:06

Post by yapt » Sun 13 Sep 2009 16:39

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...

yapt
Posts: 69
Joined: Mon 16 Mar 2009 12:06

Post by yapt » Sun 13 Sep 2009 16:44

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...

dschuch
Posts: 75
Joined: Thu 05 Feb 2009 15:29
Location: Dresden

Post by dschuch » Sun 13 Sep 2009 17:26

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.

yapt
Posts: 69
Joined: Mon 16 Mar 2009 12:06

Post by yapt » Sun 13 Sep 2009 19:28

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

yapt
Posts: 69
Joined: Mon 16 Mar 2009 12:06

Post by yapt » Sun 13 Sep 2009 19:32

Hummmmm.....

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

:-O

dschuch
Posts: 75
Joined: Thu 05 Feb 2009 15:29
Location: Dresden

Post by dschuch » Sun 13 Sep 2009 19:48

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)

yapt
Posts: 69
Joined: Mon 16 Mar 2009 12:06

Post by yapt » Sun 13 Sep 2009 20:18

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... :-((

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Mon 14 Sep 2009 10:54

You should set the UseParamTypes option of TPgQuery to True to work with parameters of domain types.

yapt
Posts: 69
Joined: Mon 16 Mar 2009 12:06

Post by yapt » Mon 14 Sep 2009 16:07

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...

Post Reply