Re: Fix for tablename in targetlist - Mailing list pgsql-hackers

From Gavin Sherry
Subject Re: Fix for tablename in targetlist
Date
Msg-id Pine.LNX.4.21.0106122253030.11264-100000@linuxworld.com.au
Whole thread Raw
In response to Fix for tablename in targetlist  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Fix for tablename in targetlist  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Bruce,

On Fri, 18 May 2001, Bruce Momjian wrote:

> We have on the TODO list:
> 
>     * SELECT pg_class FROM pg_class generates strange error
> 
> It passes the tablename as targetlist all the way to the executor, where
> it throws an error about Node 704 unkown.

The problem is caused in transformIdent() (parse_expr.c):
       if (ident->indirection == NIL &&               refnameRangeTableEntry(pstate, ident->name) != NULL)       {
        ident->isRel = TRUE;               result = (Node *) ident;       }
 

It is pretty clear what is happening here. ident->name is a member of
range table so the type of ident is not changed, as would be the case with
an attribute. Commenting this code out means that result = NULL and the
error 'Attribute 'pg_class' not found'. This, in my opinion, is the
correct error to be generated. Moreover, I cannot find any flow on effect
which may result from removing this code -- regression tests all
pass. From what I can tell, all transformations of Nodes which are of type
Ident should have already been transformed anyway -- have I over looked
something?

Gavin



pgsql-hackers by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: AW: Postgres Replication
Next
From: Darren Johnson
Date:
Subject: Re: AW: Postgres Replication