diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-03-23 00:19:30 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-03-23 00:19:30 +0000 |
commit | 19956e0d5388b11a1cc3eaf2dbf628aa531ce331 (patch) | |
tree | f2c7071f4daee4588d4c004d809bd327baa4adde /src/backend/commands/copy.c | |
parent | a3f0b3d68f9a5357a3f72b40a45bcc714a9e0649 (diff) | |
download | postgresql-19956e0d5388b11a1cc3eaf2dbf628aa531ce331.tar.gz postgresql-19956e0d5388b11a1cc3eaf2dbf628aa531ce331.zip |
Add error location info to ResTarget parse nodes. Allows error cursor to be supplied
for various mistakes involving INSERT and UPDATE target columns.
Diffstat (limited to 'src/backend/commands/copy.c')
-rw-r--r-- | src/backend/commands/copy.c | 9 |
1 files changed, 7 insertions, 2 deletions
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, |