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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-novice by date

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