Skip to content

Commit 02ca529

Browse files
committed
Make error message more verbose, in hopes of avoiding misunderstandings
such as bug #1293.
1 parent 0636d55 commit 02ca529

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/backend/parser/parse_target.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.126 2004/09/30 00:24:21 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.127 2004/10/25 03:08:29 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -486,15 +486,17 @@ transformAssignmentIndirection(ParseState *pstate,
486486
if (!typrelid)
487487
ereport(ERROR,
488488
(errcode(ERRCODE_DATATYPE_MISMATCH),
489-
errmsg("cannot assign to a column of type %s because it is not a composite type",
489+
errmsg("cannot assign to field \"%s\" of column \"%s\" because its type %s is not a composite type",
490+
strVal(n), targetName,
490491
format_type_be(targetTypeId))));
491492

492493
attnum = get_attnum(typrelid, strVal(n));
493494
if (attnum == InvalidAttrNumber)
494495
ereport(ERROR,
495496
(errcode(ERRCODE_UNDEFINED_COLUMN),
496-
errmsg("column \"%s\" not found in data type %s",
497-
strVal(n), format_type_be(targetTypeId))));
497+
errmsg("cannot assign to field \"%s\" of column \"%s\" because there is no such column in data type %s",
498+
strVal(n), targetName,
499+
format_type_be(targetTypeId))));
498500
if (attnum < 0)
499501
ereport(ERROR,
500502
(errcode(ERRCODE_UNDEFINED_COLUMN),

0 commit comments

Comments
 (0)