Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

what is this error mean

invalid input syntax for type numeric
what is this error mean
0
tankergoblin
Asked:
tankergoblin
  • 3
  • 2
1 Solution
 
earth man2Commented:
the parser is is having difficulty transforming one type into a numeric value.
try an explicit cast.
cast( xxx as numeric )
if that fails then you need to look at what characters are in that string.  Is it Nan +Infinity ???
0
 
tankergoblinAuthor Commented:
i dont know what you mean
can you explain it in detail thank you

what do you mean by cast(xxx as numeric)

and waht is NAN + infinity

0
 
earth man2Commented:
You have started another thread.  But from the extra information that you have provided there you are trying to equate a numeric column to an empty string, which gives rise to this "invalid input syntax".
(which may be coming from the DBD::PgPP interface)

+- Infinity and Nan are valid IEEE 754 entities.

create table x ( id int, y numeric );

insert into x ( id ) values (1);
insert into x values ( 2, default );
insert into x values ( 3, null );
0
 
tankergoblinAuthor Commented:
i insert data into database is base on the data in a text file. that mean i m manually add data into database.

example:
in my text file i have

name  mark
alex   54
helen
david 44

how to make it able to read null in mark as numeric data..
0
 
earth man2Commented:
Note: strict use of blanks ie no double blanks used as delimiter and blank after record with null mark.
psql -U postgres -q devdb
devdb=# \! cat csvimport.csv
name mark
alex 54
helen
david 44
devdb=# COPY tablex(name, mark) FROM '/home/postgres/csvimport.csv' DELIMITER AS ' ' NULL AS '' C
SV HEADER;
devdb=# select * from tablex;
 name  | mark
-------+------
 alex  |   54
 helen |
 david |   44
(3 rows)

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now