From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Huxton <dev@archonet.com>
Cc: Daniel Lau <iedaniel@ust.hk>
Cc: pgsql-sql@postgresql.org, Karel Zak <zakkr@zf.jcu.cz>
Subject: Re: Type conversion from TEXT to DOUBLE PRECISION
Date: Fri, 09 Jan 2004 09:57:25 -0500
Message-ID: <23739.1073660245@sss.pgh.pa.us> (raw)
In-Reply-To: <200401090809.55024.dev@archonet.com>
References: <Pine.WNT.3.96L2.1040109152354.256D-100000@iey118.ust.hk>
<200401090809.55024.dev@archonet.com>
Richard Huxton <dev@archonet.com> writes:
> Since your error seems to be complaining about a space, I'd guess you've got
> other than numeric values in _aaa.
In fact, with a bit of experimentation I see the same error message:
regression=# select to_number('12345', '99999');
to_number
-----------
12345
(1 row)
regression=# select to_number('1234 ', '99999');
to_number
-----------
1234
(1 row)
regression=# select to_number(' 1234', '99999');
to_number
-----------
1234
(1 row)
regression=# select to_number(' ', '99999');
ERROR: invalid input syntax for type numeric: " "
regression=# select to_number('zzzzz', '99999');
ERROR: invalid input syntax for type numeric: " "
regression=#
The error message's report of the input string seems a tad misleading,
especially in the last case. (Karel, is this fixable?) But anyway,
it sure looks like the problem is bad input data.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, dev@archonet.com, iedaniel@ust.hk, zakkr@zf.jcu.cz
Subject: Re: Type conversion from TEXT to DOUBLE PRECISION
In-Reply-To: <23739.1073660245@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox