1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Fix broken FOR UPDATE error message.

This commit is contained in:
Tom Lane
2000-01-16 08:21:59 +00:00
parent 1b6b4d40ed
commit 7d715ba063

View File

@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: analyze.c,v 1.129 2000/01/15 02:59:31 petere Exp $ * $Id: analyze.c,v 1.130 2000/01/16 08:21:59 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -1573,14 +1573,16 @@ transformForUpdate(Query *qry, List *forUpdate)
foreach(l, forUpdate) foreach(l, forUpdate)
{ {
char *relname = lfirst(l);
List *l2; List *l2;
List *l3;
i = 1; i = 1;
foreach(l2, qry->rtable) foreach(l2, qry->rtable)
{ {
if (strcmp(((RangeTblEntry *) lfirst(l2))->refname, lfirst(l)) == 0) if (strcmp(((RangeTblEntry *) lfirst(l2))->refname, relname) == 0)
{ {
List *l3;
foreach(l3, rowMark) foreach(l3, rowMark)
{ {
if (((RowMark *) lfirst(l3))->rti == i) /* duplicate */ if (((RowMark *) lfirst(l3))->rti == i) /* duplicate */
@ -1598,11 +1600,11 @@ transformForUpdate(Query *qry, List *forUpdate)
i++; i++;
} }
if (l2 == NULL) if (l2 == NULL)
elog(ERROR, "FOR UPDATE: relation %s not found in FROM clause", strVal(lfirst(l))); elog(ERROR, "FOR UPDATE: relation %s not found in FROM clause",
relname);
} }
qry->rowMark = rowMark; qry->rowMark = rowMark;
return;
} }