Skip site navigation (1) Skip section navigation (2)

Re: Changing a relation's name in parser stage

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Matthias Lenz" <ml134883(at)inf(dot)tu-dresden(dot)de>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Changing a relation's name in parser stage
Date: 2004-05-10 23:43:25
Message-ID: 20155.1084232605@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
"Matthias Lenz" <ml134883(at)inf(dot)tu-dresden(dot)de> writes:
> List *i;
> i=nth(1, stmt->fromClause);
> ((RangeVar *) lfirst(i))->relname = "s_overall";

nth() is going to give you a list element, not a List*.  So you don't
want the lfirst() call.  I'm also dubious about whether you didn't mean
nth(0, stmt->fromClause) --- nth() counts from zero not one.  Finally,
it seems extremely fragile to assume that fromClause entries are
necessarily RangeVars without checking.  There are other node types that
could be there.

			regards, tom lane

In response to

Responses

pgsql-novice by date

Next:From: Ian PilcherDate: 2004-05-11 13:48:31
Subject: Darn pop singers!
Previous:From: David CruzDate: 2004-05-10 15:38:55
Subject: Question about REF / DREF

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group