Re: Shall we just get rid of plpgsql's RENAME?

Поиск
Список
Период
Сортировка
От Dimitri Fontaine
Тема Re: Shall we just get rid of plpgsql's RENAME?
Дата
Msg-id 878wel81ph.fsf@hi-media-techno.com
обсуждение исходный текст
Ответ на Shall we just get rid of plpgsql's RENAME?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: operator exclusion constraints
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Shall we just get rid of plpgsql's RENAME?