Re: PL/pgSQL RENAME bug?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
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: 2001-11-12 05:08:40
Message-ID: 200111120508.fAC58eH18456@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers


Is this completed?

---------------------------------------------------------------------------

> "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...
>
> > 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?
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Travis Bauer 2001-11-12 05:12:25 [general] Permissions
Previous Message Bruce Momjian 2001-11-12 03:54:44 Re: Creating a table

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-11-12 05:32:26 Re: Small FK patch to deal with tables without oids
Previous Message Bruce Momjian 2001-11-12 04:41:59 Re: [patch] helps fe-connect.c handle -EINTR more gracefully