Re: error code invalid_input_syntax

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rainer Leo <leo(at)workfile(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: error code invalid_input_syntax
Date: 2006-01-12 16:05:49
Message-ID: 5380.1137081949@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Rainer Leo <leo(at)workfile(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Markus Schaber 2006-01-12 17:01:41 Re: plpgsql triggers in rules
Previous Message Tom Lane 2006-01-12 15:46:37 Re: foreign keys with on delete cascade and triggers