Re: Shall we just get rid of plpgsql's RENAME? - Mailing list pgsql-hackers

From Dimitri Fontaine
Subject Re: Shall we just get rid of plpgsql's RENAME?
Date
Msg-id 878wel81ph.fsf@hi-media-techno.com
Whole thread Raw
In response to Shall we just get rid of plpgsql's RENAME?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,

Tom Lane <tgl@sss.pgh.pa.us> writes:
>     DECLARE x int;
>     BEGIN
>         ... some stuff ...
>         DECLARE y int;
>             RENAME x to z;
>         BEGIN
>             ... other stuff ...
>         END;
>         ... yet more stuff ...
>     END;
>
> What effect should the RENAME have on the name of "x" as seen by the
> code outside the inner DECLARE block?

None in my mind.

> As the documentation points out, there doesn't seem to be any real
> use for RENAME that isn't served as well or better by ALIAS, so
> I'm not especially interested in trying to puzzle out what it should
> do or how to make it do that.  I want to just remove it.  Or we could
> make it an alternative spelling for ALIAS.  Comments?

The difference I'd not be surprised to see between RENAME and ALIAS
would be for RENAME to allow for inner blocks to reuse the renamed
variable (x in ... other stuff ... in your example), whereas using ALIAS
the variable just has 2 names.

Does it make any sense?
-- 
dim


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: operator exclusion constraints
Next
From: Tom Lane
Date:
Subject: Re: Shall we just get rid of plpgsql's RENAME?