Show schema in COPY error CONTEXT strings

From: Greg Sabino Mullane <greg(at)turnstep(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Show schema in COPY error CONTEXT strings
Date: 2010-05-02 15:50:31
Message-ID: 20100502155031.GA8404@core.home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)endpoint(dot)com
End Point Corporation
PGP Key: 0x14964AC8

Attachment Content-Type Size
show_schema_in_copy_error_context.patch text/plain 11.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2010-05-02 16:01:01 Re: pg_migrator to /contrib in a later 9.0 beta
Previous Message Bruce Momjian 2010-05-02 15:49:08 Re: pg_migrator to /contrib in a later 9.0 beta