Re: BUG #1956: Plpgsql top-level DECLARE does not share scope

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #1956: Plpgsql top-level DECLARE does not share scope
Дата
Msg-id 2397.1129235063@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #1956: Plpgsql top-level DECLARE does not share scope  ("Jim C. Nasby" <jnasby@pervasive.com>)
Ответы Re: BUG #1956: Plpgsql top-level DECLARE does not share  ("Karl O. Pinc" <kop@meme.com>)
Re: BUG #1956: Plpgsql top-level DECLARE does not share scope  ("Jim C. Nasby" <jnasby@pervasive.com>)
Re: BUG #1956: Plpgsql top-level DECLARE does not share scope  (Klint Gore <kg@kgb.une.edu.au>)
Список pgsql-bugs
"Jim C. Nasby" <jnasby@pervasive.com> writes:
> On Thu, Oct 13, 2005 at 01:30:56PM -0400, Tom Lane wrote:
>> Basically, DECLARE introduces a new name scope that wouldn't be there
>> if you didn't say DECLARE.  Without some bizarre reinterpretation of the
>> meaning of a DECLARE at the start of a function, variables automatically
>> created by plpgsql are going to be in an outer scope surrounding that of
>> the first DECLARE.

> Another possibility is tracking what level sub-block something is in,
> and using that to determine if the top-most declare in a function is
> over-writing something.

BTW, another issue here is that if we did merge the first DECLARE with
the scope of auto-declared variables, it would be a non backwards
compatible change.  Right now you can do, say,

    declare found int;

and it'll override the standard FOUND variable.  If we change this then
you'd get an error.  (Of course, it could be argued that that would be
a Good Thing.  But it would inhibit us from adding new auto-declared
variables that are less central to the language than FOUND, because of
the risk of breaking existing code.)

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: BUG #1956: Plpgsql top-level DECLARE does not share scope
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: BUG #1931: ILIKE and LIKE fails on Turkish locale