]> granicus.if.org Git - postgresql/commitdiff
Fix broken FOR UPDATE error message.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 16 Jan 2000 08:21:59 +0000 (08:21 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 16 Jan 2000 08:21:59 +0000 (08:21 +0000)
src/backend/parser/analyze.c

index bf8494c18cbfc84c41f3bc7ec9e2ad5ebe59a5a7..0dd1e9907a8aa1c631ebc867a99f50c11556878d 100644 (file)
@@ -5,7 +5,7 @@
  *
  * 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)
        {
+               char       *relname = lfirst(l);
                List       *l2;
-               List       *l3;
 
                i = 1;
                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)
                                {
                                        if (((RowMark *) lfirst(l3))->rti == i)         /* duplicate */
@@ -1598,11 +1600,11 @@ transformForUpdate(Query *qry, List *forUpdate)
                        i++;
                }
                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;
-       return;
 }