pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
error code invalid_input_syntax
2+ messages / 2 participants
[nested] [flat]

* error code invalid_input_syntax
@ 2006-01-12 08:43  Rainer Leo <leo@workfile.de>
  0 siblings, 1 reply; 2+ messages in thread

From: Rainer Leo @ 2006-01-12 08:43 UTC (permalink / raw)
  To: pgsql-sql

I wrote a function which generates SQL statements
for INSERTs and UPDATEs, in which I cast the values
to the correct datatype.

Now I want to catch

ERROR:  invalid input syntax for integer: "i"

but although I tried quite a few I can't find the right
error code for this exception.

Is it possible that this error can not be caught?


Thanks
Leo




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: error code invalid_input_syntax
@ 2006-01-12 16:05  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Rainer Leo <leo@workfile.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2006-01-12 16:05 UTC (permalink / raw)
  To: Rainer Leo <leo@workfile.de>; +Cc: pgsql-sql

Rainer Leo <leo@workfile.de> writes:
> Now I want to catch
> ERROR:  invalid input syntax for integer: "i"
> but although I tried quite a few I can't find the right
> error code for this exception.

Crank up the error reporting verbosity.  For instance, in psql

regression=# select 'i'::integer;
ERROR:  invalid input syntax for integer: "i"
regression=# \set VERBOSITY verbose
regression=# select 'i'::integer;
ERROR:  22P02: invalid input syntax for integer: "i"
LOCATION:  pg_atoi, numutils.c:84
regression=#

A look in Appendix A of the manual shows that 22P02 is
INVALID TEXT REPRESENTATION

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2006-01-12 16:05 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-01-12 08:43 error code invalid_input_syntax Rainer Leo <leo@workfile.de>
2006-01-12 16:05 ` Tom Lane <tgl@sss.pgh.pa.us>

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