Show schema in COPY error CONTEXT strings

Greg Sabino Mullane <greg@turnstep.com>

From: Greg Sabino Mullane <greg@turnstep.com>
To: pgsql-hackers@postgresql.org
Date: 2010-05-02T15:50:31Z
Lists: pgsql-hackers

Attachments

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"

I had to change the initial table in test/regress/sql/copy2.sql 
from a temp table to a real table, as I could not find an easy 
way to represent a wild card temp schema name inside of the
test/regres/expected/copy2.out file.

-- 
Greg Sabino Mullane greg@endpoint.com
End Point Corporation
PGP Key: 0x14964AC8