error code invalid_input_syntax
error code invalid_input_syntax
От:
Rainer Leo <leo@workfile.de>
Дата:
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
Re: error code invalid_input_syntax
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Rainer Leo 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