Re: PL/pgSQL RENAME bug?

From: Jan Wieck <janwieck(at)yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Command Prompt, Inc(dot)" <pgsql-hackers(at)commandprompt(dot)com>, Hackers List <pgsql-hackers(at)postgresql(dot)org>, Jan Wieck <JanWieck(at)yahoo(dot)com>
Subject: Re: PL/pgSQL RENAME bug?
Date: 2002-02-20 18:39:41
Message-ID: 200202201839.g1KIdf426907@saturn.janwieck.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Tom Lane wrote:
> "Command Prompt, Inc." <pgsql-hackers(at)commandprompt(dot)com> writes:
> > Mainly, the existing documentation on the RENAME statement seems
> > inaccurate; it states that you can re-name variables, records, or
> > rowtypes. However, in practice, our tests show that attempting to RENAME
> > valid variables with:
> > RENAME varname TO newname;
> > ...yeilds a PL/pgSQL parse error, inexplicably. If I try the same syntax
> > on a non-declared variable, it actually says "there is no variable" with
> > that name in the current block, so...I think something odd is happening. :)
>
> Yup, this is a bug. The plpgsql grammar expects varname to be a T_WORD,
> but in fact the scanner will only return T_WORD for a name that is not
> any known variable name. Thus RENAME cannot possibly work, and probably
> never has worked.
>
> Looks like it should accept T_VARIABLE, T_RECORD, T_ROW (at least).
> T_WORD ought to draw "no such variable". Jan, I think this is your turf...

Sounds pretty much like that. Will take a look.

>
> > The RENAME statement seems kind of odd, since it seems that you could just
> > as easily declare a general variable with the right name to begin with,
>
> It seems pretty useless to me too. Perhaps it's there because Oracle
> has one?

And I don't even remember why I've put it in. Maybe because
it's an Oracle thing. This would be a cool fix, removing the
damned thing completely. I like that solution :-)

Anyone against removal?

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Miguel Carvalho 2002-02-20 18:42:50 Select from another database ´....best Way!
Previous Message Chris Bowlby 2002-02-20 18:12:14 Error...

Browse pgsql-hackers by date

  From Date Subject
Next Message Teodor Sigaev 2002-02-20 18:47:07 Pls, apply patch....
Previous Message Cyril Samovskiy 2002-02-20 18:23:27 foreign key is from different tables - what to do?