Re: Show schema in COPY error CONTEXT strings

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Greg Sabino Mullane <greg@turnstep.com>
Cc: pgsql-hackers@postgresql.org
Date: 2010-05-02T16:12:42Z
Lists: pgsql-hackers
Greg Sabino Mullane <greg@turnstep.com> writes:
> Use case: when running a process that populates many inherited 
> tables across schemas, having one fail gives the unhelpful 
> error message:

> ERROR:  invalid input syntax for integer: "abc"
> CONTEXT:  COPY foo, line 1, column a: "abc"

> Unhelpful because "foo" does not uniquely identifies the table 
> or statement in question, which was actually: COPY alpha.foo FROM STDIN;
> where 'alpha' was one of scores of schemas being populated. This 
> patch changes the output to:

> ERROR:  invalid input syntax for integer: "abc"
> CONTEXT:  COPY alpha.foo, line 1, column a: "abc"

We're really not going to address this type of complaint on a
one-error-message-at-a-time basis.  See prior discussions --- a more
realistic (and standards compliant) approach will probably involve
adding fields to the verbose form of the error message.

			regards, tom lane