mirror of
https://github.com/postgres/postgres.git
synced 2025-08-27 07:42:10 +03:00
Add error location info to ResTarget parse nodes. Allows error cursor to be supplied
for various mistakes involving INSERT and UPDATE target columns.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.92 2006/03/05 15:58:23 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.93 2006/03/23 00:19:28 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -216,6 +216,11 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt)
|
||||
char *col = strVal(lfirst(le));
|
||||
|
||||
i = attnameAttNum(onerel, col, false);
|
||||
if (i == InvalidAttrNumber)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_COLUMN),
|
||||
errmsg("column \"%s\" of relation \"%s\" does not exist",
|
||||
col, RelationGetRelationName(onerel))));
|
||||
vacattrstats[tcnt] = examine_attribute(onerel, i);
|
||||
if (vacattrstats[tcnt] != NULL)
|
||||
tcnt++;
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user