From 19956e0d5388b11a1cc3eaf2dbf628aa531ce331 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 23 Mar 2006 00:19:30 +0000 Subject: Add error location info to ResTarget parse nodes. Allows error cursor to be supplied for various mistakes involving INSERT and UPDATE target columns. --- src/backend/commands/copy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/backend/commands/copy.c') diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 23c1d0bcedc..23c057af8e0 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.260 2006/03/05 15:58:23 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.261 2006/03/23 00:19:29 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -3109,9 +3109,14 @@ CopyGetAttnums(Relation rel, List *attnamelist) char *name = strVal(lfirst(l)); int attnum; - /* Lookup column name, ereport on failure */ + /* Lookup column name */ /* Note we disallow system columns here */ attnum = attnameAttNum(rel, name, false); + if (attnum == InvalidAttrNumber) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_COLUMN), + errmsg("column \"%s\" of relation \"%s\" does not exist", + name, RelationGetRelationName(rel)))); /* Check for duplicates */ if (list_member_int(attnums, attnum)) ereport(ERROR, -- cgit v1.2.3